The .NET Agent automatically instruments IIS applications only. However, you can follow the instructions in this topic 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
mywebappapplication.exe. In this scenario, the application's site name and application path are not discovered automatically. You need to configure these applications manually and provide tier and node names that best describe the application.
To instrument Windows services and standalone .NET applications, you edit the .NET Agent configuration file,
Instrument the default domain if that is where your application runs, as 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, run the following command:
tasklist /m "mscor*"
This command only works for 64-bit processes. For 32-bit processes, use the process explorer to view the dependencies of the process and whether there are any .NET .dll files loaded into the file.
The output lists the processes that have DLLs starting with mscor
*, indicative of .NET processes. Processes that are not on the list are not .NET processes and cannot be instrumented 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 the following steps to generate one:
If you want to avoid instrumenting IIS applications, choose the manual tier naming approach and omit the step of assigning tiers for the IIS application. This disables instrumentation for the IIS applications, allowing 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 assign 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.xmlfile 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, as in the following example:
If you have already instrumented IIS applications, those configurations appear under the IIS element.
Add a single standalone applications element,
standalone-applicationsunder the app-agents element, and under the
standalone-applicationselement, add a standalone application element,
standalone-applicationfor each Windows service or standalone application to instrument. For example:
In the standalone application element configuration:
tierelement 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
executableattribute using one of the following formats:
Executable name: For example,
MyWindowsService.exe. The file extension is optional, so
MyStandaloneAppalso works. If
dotnet.exeis used for starting the .NET Core application, then specify
"dotnet.exe"as application executable (see Sample Configuration File for details).
Full or partial path to the executable: For example,
MyApplication\MyStandaloneApp.exe. Use the full or partial path when you want 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 on the service and choose Properties. The path appears in the General tab.
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/method in your service for the agent to begin instrumentation.
Sample Configuration File
config.xml demonstrates instrumentation for a Windows service and standalone application:
If the .Net Core application is published as executable, then it can be configured 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 it is started by invoking the
The following sample configuration demonstrates how to instrument a .NET Core standalone application hosted by the
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 happens. This problem may present intermittently and is not common.
The following describes the procedures required to overcome this problem for Windows 2012 and later, and for Windows 2008.
Windows 2012 and later
To ensure the AppDynamics.Agent.Coordinator service initializes before the instrumented Windows Service, modify the registry as follows:
Edit the Reg key
EarlyStartServices @HKLM:\SYSTEM\CurrentControlSet\Control and add
AppDynamics.Agent.Coordinator_service to the list of early start services.
If you are using Windows 2008, please contact AppDynamics Support for assistance.