On this page:
You can configure the .NET Agent to monitor ASP.NET applications with multiple Application Domains (AppDomains). This topic assumes you have a working knowledge of AppDomains and that you are familiar with the AppDomain implementation in your application.
This topic does not cover the System Domain, Shared Domain, or DefaultDomain AppDomains the CLR instantiates before it executes the managed code. If your standalone application runs in the DefaultDomain, see Instrument the DefaultDomain for Standalone Applications.
Windows uses processes to manage security and performance isolation between running applications. Process isolation ensures one application's running code doesn't interfere with another application. However, for applications that share data, making calls between Windows processes can introduce complications and performance issues. AppDomains enable developers to create several applications that run inside a single process but maintain application isolation.
In the case of a single application running inside its own process, the runtime host typically manages the AppDomain. The application executable and the AppDomain have the same name. The (agent) installs itself inside the single AppDomain and creates a node for the application.
When developers include multiple AppDomains in an application, all the AppDomains run inside a single process. The application executable may have the same name as one AppDomain, but there are other, uniquely named AppDomains. By default, the agent installs itself inside all the AppDomains and creates nodes for them.
If the application you monitor contains multiple AppDomains, the App Agent for .NET automatically instruments each AppDomain and creates a node. You can configure the to instrument only the AppDomains you specify. This is useful to exclude AppDomains you don't want to monitor and to limit the number of nodes in a tier.
You can configure application domain monitoring for:
Configure all instrumentation settings for the .NET Agent in the config.xml file. See "Where to Configure Agent Properties" on Administer the .NET Agent.
Identify the name of the AppDomains you want to instrument.
If you have already instrumented your application, you can see the AppDomain names in the Node Dashboard.
Add the app-domain-name attribute to the element.
For example, to instrument the MyApp.exe AppDomain for the MyApp.exe standalone application:
<standalone-application executable="MyApp.exe" app-domain-name="MyApp.exe"> <tier name="StandaloneApplication Tier"/> </standalone-application>
As soon as you instrument one AppDomain in the config.xml, the agent instruments only the AppDomains you specify. Other AppDomains are not instrumented.
To instrument additional AppDomains, add an element for each AppDomain as if they were separate applications.
For example, to instrument MyAppDomain1 in MyApp.exe:
<standalone-application executable="MyApp.exe" app-domain-name="MyAppDomain1"> <tier name="StandaloneApplication Tier"/> </standalone-application>
This sample config.xml shows the configuration for the application MyApp.exe. Instrumentation only applies to the AppDomains specified in the config.xml: MyApp.exe and MyAppDomain2.
<?xml version="1.0" encoding="utf-8"?> <appdynamics-agent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <controller host="mycontroller.mycompany.com" port="8090" ssl=false"> <account name="customer1" password="changeme" /> <application name="MyDotNetApplication" /> </controller> <machine-agent /> <app-agents> <standalone-applications> <standalone-application executable="MyApp.exe" app-domain-name=""MyApp.exe"> <tier name="StandaloneApplication Tier"/> </standalone-application> <standalone-application executable="MyApp.exe" app-domain-name=""MyAppDomain2"> <tier name="StandaloneApplication Tier"/> </standalone-application> </standalone-applications> </app-agents> </appdynamics-agent>