This article is under revision to include the latest released .NET Core frameworks. Want to be notified when the revision is live? Click the 3-dot menu upper right, then Subscribe
Table of Contents
Who should follow these steps?
What should I do before starting?
Steps for adding the required DLLs to your existing project
Who should follow these steps?
You can follow the steps in this article if your .NET Core-based application is already running on a production environment or any other environment on Windows where you are targeting to instrument the application, but you don’t have the flexibility of recompiling the application after installing the NuGet package. In spite of that, you want to instrument your running application with the AppDynamics Microservices Agent. In this scenario, you only need to deploy the required DLLs and configuration directly into the production environment or any other environment where you are targeting to instrument the application.
If you need to install the NuGet package into your .NET project with the assistance of Visual Studio before deploying it into the production environment or any other environment for instrumentation, follow the steps outlined in Install the .NET Core Microservices Agent for Windows instead. The steps below would not apply to you.
What should I do before starting?
As mentioned above, these steps are intended for customers who are running .NET Core 2.0+ based applications hosted on a Windows environment.
Before you instrument the application, make sure you have access to the AppDynamics Controller in which your application metrics will appear. Refer the Agent and Controller Compatibility document to ensure your Controller version is compatible with your agent version.
Steps for adding the required DLLs to your existing project
To instrument your application with AppDynamics .NET Core Microservices Agent, you will need the required DLLs and configuration in the deployment folder location. To get the DLLs and configuration files, you have a few options. You can:
Download it from NuGet using the AppDynamics.Agent.Distrib.Micro.Windows package
Use or create a sample .NET based application and install the NuGet package (AppDynamics.Agent.Windows) over there to get the required files
Use NuGet CLI (https://dist.nuget.org/win-x86-commandline/latest/nuget.exe): "NuGet install AppDynamics.Agent.Distrib.Micro.Windows" You will need to get the following files from there:
AppDynamics.Profiler_x64.dll
AppDynamics.Profiler_x86.dll
AppDynamics.Agent.netstandard.dll
AppDynamicsConfig.json file
AppDynamicsAgentLog.config The screenshot below shows an example of a publish folder that is mapped to an application that is configured and running in the IIS.
Put all of the files into the deployment folder, as shown in the screenshot below. Remember that you need to rename the AppDynamicsConfig.json file as per your application name. In this example, the application DLLs is name is TestNetCoreApplication.dll so the AppDynamicsConfig.json file will be named TestNetCoreApplication.AppDynamicsConfig.json for your application project.
Complete the Controller connection information in the *.AppDynamicsConfig.json file as shown below. {
"controller": {
"host": "example_demo.saas.appdynamics.com",
"port": 80,
"account": "account_name",
"password": "password",
"ssl": false,
"enable_tls12": false
},
"application": {
"name": "Application_Name",
"tier": "Tier_Name",
"node": "Node_Name"
}
}
You can also modify the AppDynamicsAgentLog.config to add the specific path to Agent Logs. Example By default, the path will appear like this: <target name="logfile" xsi:type="File" archiveAboveSize="5000000" maxArchiveFiles="5" createDirs="true" fileName="${environment:variable=PROGRAMDATA}\AppDynamics\DotNetAgent\Logs\AgentLog.txt" layout="${longdate} ${processid} ${processname} ${appdomainid} ${threadid} ${level} ${logger:shortName=True} ${message}" /> You can modify it with any of the desired locations, as shown below: <target name="logfile" xsi:type="File" archiveAboveSize="5000000" maxArchiveFiles="5" createDirs="true" fileName="C:\APPDYNAMICS_Logs\AppDynamics\DotNetAgent\Logs\AgentLog.txt" layout="${longdate} ${processid} ${processname} ${appdomainid} ${threadid} ${level} ${logger:shortName=True} ${message}" />
Set the environment variables for the AppDynamics core agent profiler, as shown below. CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={39AEABC1-56A5-405F-B8E7-C3668490DB4A}
CORECLR_PROFILER_PATH_32=<actual_path>\AppDynamics.Profiler_x86.dll
CORECLR_PROFILER_PATH_64=<actual_path>\AppDynamics.Profiler_x64.dll
Where <actual_path> is the complete path to the AppDynamics.Profiler dll.
You can also set the environment variable in the Web.config file so it will get the value during the runtime. Example <?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\TestNetCoreApplication.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
<environmentVariables>
<environmentVariable name="CORECLR_ENABLE_PROFILING" value="1" />
<environmentVariable name="CORECLR_PROFILER" value="{39AEABC1-56A5-405F-B8E7-C3668490DB4A}" />
<environmentVariable name="CORECLR_PROFILER_PATH_64" value=".\AppDynamics.Profiler_x64.dll" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
<!--ProjectGuid: 99ed82fd-f96d-48bc-92f7-7615a67d89a8-->
Restart your hosted application. Your app will instrument through the agent and report data to the configured Controller.
... View more