Download PDF
Download page Configure the .NET Agent for Windows Services and Standalone Applications.
Configure the .NET Agent for Windows Services and Standalone Applications
The .NET Agent automatically instruments IIS applications only. However, you can follow these instructions to manually configure the .NET Agent to instrument Windows services or standalone .NET applications.
If your web application is not configured to run as an in-process handler, the application may run as dotnet.exe
or mywebappapplication.exe
. In this scenario, the application's site name and application path are not discovered automatically. You must configure these applications manually, and provide tier and node names that best describe the application.
Before You Begin
To instrument Windows services and standalone .NET applications, edit the .NET Agent configuration file, config.xml
.
If your application runs using the default domain, you must manually instrument it. AppDynamics does not automatically instrument the default domain out-of-the-box. To determine whether you should use the default domain, and how to configure it, see Instrument the DefaultDomain for Standalone Applications.
Before starting, verify that the services or applications you want to instrument are .NET applications rather than native applications or another type of application. From a command line, enter:
tasklist /m "mscor*"
This command is for 64-bit processes only. For 32-bit processes, use the process explorer to view the dependencies of the process, and determine if there are any .NET .dll files loaded into the file.
The output lists the processes with DLLs starting with mscor*
, indicative of .NET processes. Processes not displaying on the list are not .NET processes, and you cannot instrument them with the .NET Agent.
If you have previously instrumented IIS applications on the server that hosts the Windows services and standalone applications, the server should already have a config.xml
file that you can edit. If not, perform these steps to generate one:
- Install the .NET Agent for Windows.
- Run the AppDynamics Agent Configuration utility.
To avoid instrumenting IIS applications, select the manual tier naming approach and omit the step of assigning tiers for the IIS application. This disables instrumentation for the IIS applications and enables you to instrument only the intended Windows services or standalone applications.
The utility performs these configuration tasks:
- Changes the location of the logs directory, and assigns permissions.
- Configures and tests connectivity to the Controller.
Sets the business application for the agent.
Manually Configure the .NET Agent
Once you have configured the Controller properties for the .NET Agent, instrument your Windows service or standalone application by adding the Standalone Applications element to the config.xml
.
Edit the
config.xml
file as an administrator. See Administer the .NET Agent.If you have not instrumented any IIS applications, the file contains the minimal configuration for the Controller connectivity and the Machine Agent. Verify the Controller properties and the Business Application name (shown in this example):
<?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.example.com" port="8090" ssl="false"> <application name="My Business Application" /> </controller> ... </appdynamics-agent>
If you have already instrumented IIS applications, those configurations display under the IIS element.
Add a single standalone applications element,
standalone-applications
under the app-agents element, and under thestandalone-applications
element, add a standalone application element,standalone-application
for each Windows service or standalone application to instrument. For example:... <app-agents> ... <standalone-applications> <standalone-application executable="MyStandaloneApp.exe"> <tier name="Standalone Tier 1" /> </standalone-application> <!-- Instrument a standalone application using a partial path. --> <standalone-application executable="MyApplication\MyOtherStandaloneApp.exe"> <tier name="Standalone Tier 2" /> </standalone-application> <!-- Instrument a Windows service using arguments. --> <!-- The following example matches the command "MyWindowsService.exe -d -x -r". --> <standalone-application executable="MyWindowsService.exe" command-line="-x"> <tier name="Windows Service Tier" /> </standalone-application> </standalone-applications> </app-agents> ...
In the standalone application element configuration:
Use the
tier
element to assign the instrumented application to a tier in the Controller. See .NET Agent Configuration Properties.Identify the executable file of the application in the Standalone Application element
executable
attribute using one of these formats:Executable name: For example,
MyStandaloneApp.exe
orMyWindowsService.exe
. The file extension is optional, soMyStandaloneApp
is valid. If you usedotnet.exe
to start the .NET Core application, then specify"dotnet.exe"
as the application executable (see Sample Configuration File).Full or partial path to the executable: For example,
C:\Program Files\MyApplication\MyStandaloneApp.exe
orMyApplication\MyStandaloneApp.exe
. Use the full or partial path to assign different AppDynamics tiers to separate instances of the same executable file running from different paths.To differentiate between two instances of the same executable, specify any unique portion of the command line invocation format of the application, such as an argument, in the Standalone Application command-line attribute.
You can discover the path to a Windows service executable in the Services panel of the administrative tools. In Services, click the service and select Properties. The path display in the General tab.
Restart the
AppDynamics.Agent.Coordinator
service.Restart the Windows service or standalone application.
If your Windows service or standalone application does not implement an auto-detected framework, you must configure a POCO entry point for a class or method in your service for the agent to begin instrumentation.
Sample Configuration File
This sample config.xml
shows instrumentation for a Windows service and standalone application:
<?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"> <application name="My Business Application" /> </controller> <machine-agent /> <app-agents> <IIS> <applications /> </IIS> <standalone-applications> <standalone-application executable="MyWindowsService.exe" command-line="-x"> <tier name="Windows Service Tier" /> </standalone-application> <standalone-application executable="MyStandaloneApp.exe"> <tier name="Standalone Tier" /> </standalone-application> </standalone-applications> </app-agents> </appdynamics-agent>
If the .Net Core application is published as an executable, then you can configure it similar to .NET Framework applications by specifying the executable name, and optionally, the command line. However, if the application is published as a library, then you start it by by invoking the dotnet.exe
tool.
This sample configuration shows how to instrument a .NET Core standalone application hosted by the dotnet.exe
:
<?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"> <application name="My Business Application" /> </controller> <machine-agent /> <app-agents> <IIS> <applications /> </IIS> <standalone-applications> <standalone-application executable="dotnet.exe" command-line="MyApp.dll"> //command-line option instructs the agent to monitor only "MyApp" <tier name="DotNet Core Tier" /> </standalone-application> </standalone-applications> </app-agents> </appdynamics-agent>
Troubleshooting
Intermittent Loss of Windows Services Instrumentation
When instrumenting Windows Services, there may be cases where the instrumented service initializes before the AppDynamics.Agent.Coordinator
service. When this happens, the Profiler shuts down and no instrumentation occurs. This problem is uncommon.
These procedures describe how to overcome this problem for Windows 2008, and Windows >= 2012.
Windows 2008
If you are using Windows 2008, please contact AppDynamics Support for assistance.
Windows >= 2012
To ensure the AppDynamics.Agent.Coordinator service initializes before the instrumented Windows Service, you must modify the registry.
Edit the Reg key EarlyStartServices @HKLM:\SYSTEM\CurrentControlSet\Control
, and add AppDynamics.Agent.Coordinator_service to the list of early start services.