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 mywebappapplication.exe
Before You Begin
To instrument Windows services and standalone .NET applications, edit the .NET Agent configuration file, config.xml
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*"
The output lists the processes with DLLs starting with mscor *
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
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
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
These procedures describe how to overcome this problem for Windows 2008, and Windows >= 2012.
Windows 2008
Windows 2008If you are using Windows 2008, contact AppDynamics Support for assistance.
Windows >= 2012
Windows >= 2012To ensure the AppDynamics.Agent.Coordinator service initializes before the instrumented Windows Service, you must modify the registry: In the registry key @HKLM:\SYSTEM\CurrentControlSet\Control\EarlyStartServices (the list of early start servies), add AppDynamics.Agent.Coordinator_service