NET (Agent, Installation)

Showing results for 
Search instead for 
Did you mean: 

How to deploy the .NET Core Agent on a Windows Host post App Deployment

AppDynamics Team

How to deploy the .NET Core Agent on a Windows Host post App Deployment

There are occasions where a customer will push a .NET Core application to a windows host without using nuget, or any of the microservice push capabilities out of VisualStudio. I find this most commonly where the development team is pushing their apps to a repository but the devops team then needs to load the agent during actual deployment.


The steps below outline how to instrument an already deployed application. These steps can be followed and implemented for devops operations.


NOTE: This will take up a full non-microservice APM license.


Step-by-step guide


STEP 1: Download the .NET Core agent for Windows

  1. Open a web browser
  2. Navigate to:
  3. Search for “AppDynamics”
  4. Determine which package to download here:

If the host is a single Windows VM not running in Azure or is a single Windows host, agnostic to the cloud environment (i.e. customer administers the OS), then download “AppDynamics.Agent.Distrib.Micro.Windows"


STEP 2: Install the AppDynamics Agent DLLs

  1. Create a directory (preferably at root C: level) for where the AppDynamics Agent DLL files will reside. Example: C:\AppDynamics\dotNETcoreAgent\
  2. Permit read, write and execute to the users of the .NET Core application




    IIS: If the application is an ASP.NET Core application running in IIS, then make sure that “IIS_IUSRS” has full access.


  3. Extract the downloaded "AppDynamics.Agent.Distrib.Micro.Windows" nuget package into a temporary directory.
  4. Navigate into the "tools" subdirectory of the extracted nuget package.
  5. Copy the following files into the newly created directory from STEP 2.1


STEP 3: Setup Environment Variables for the .NET Core CLR Profiler



Environment variables are described in detail here:


  1. Open Windows Explorer
  2. Right click “This PC”
  3. Click “Properties”
  4. Click “Advanced System Settings”
  5. Click “Advanced” Tab
  6. Click “Environment Variables…”



  7. Click “New…” under “System variables” and add each of the following.


    NOTE: <appd_agent_path> is the path created in STEP 2.1 above






  8. Click “OK” out of each dialog and close all windows.

STEP 4: Configure the AppDynamics Agent

    1. Copy the “AppDynamicsConfig.json” file to the Application’s directory (where the .NET Core DLL files reside).
    2. Rename “AppDynamicsConfig.json” to “<APP>.AppDynamicsConfig.json”


      If unsure the name of the application ask the developers or those who deploy and start the application.


      For IIS ASP.NET Core applications, the name of the applications can be found in “web.config” within the application’s directory.


    3. Edit the “<APP>.AppDynamicsConfig.json” file and configure as described here:


      1. At minimum, need “Controller” and “Application” fields sets (reference docs).
      2. When there are multiple .NET Core "Service/app" deployed on 1 host
        • The "tier" and "node" should be different for each "service/app" even though they reside on the same host.
      3. The application "name" will be the same for all "services/apps" that should be grouped together to logically complete/represent an application.


    4. Save and close the file.

STEP 5: Restart the application



If application is an IIS ASP.NET Core application, then a full IIS restart is required. This can be done by opening a command prompt and executing: iisreset



Tags (3)
How to deploy the .NET Core Agent on a Windows Host post App Deployment

Re: How to deploy the .NET Core Agent on a Windows Host post App Deployment

Hello Frank,


@Frank.Martens  thanks for this post, this was more useful than official AppD documentation. 


I made a progress but core instrumentation is still not working for me. 

I followed your steps and be able to get metric to controller but *only when starting application from CLI* using:

c:\inetpub\wwwroot>dotnet WebApp.dll
Agent runtime conf directory set to C:\AppDynamics\dotNETcoreAgent\\conf
Running non-obfuscated agent
Hosting environment: Production
Content root path: c:\inetpub\wwwroot
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Registered app server agent with Node ID[376309] Component ID[47839] Application ID [1102]

Since I'm using exactly the same process as you described (ops team need to install the agent during deployment on IIS), when starting application using IIS I cannot get it to working state. IIS won't pick up the agent.

I double checked everything using your instructions:

- environment variables are set up System wide - I also tried setting them up in web.config but still nothing

- "IIS_IUSRS” has full control on agent directory


This is from aspnetcore stdout log:

Hosting environment: Production
Content root path: C:\inetpub\wwwroot
Application started. Press Ctrl+C to shut down.
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.

There I can see that the appd agent dlls are not correctly picked up. Event viewer is clear nothing special there.  

If you have any idea regarding my problem I would be very thankful.







Re: How to deploy the .NET Core Agent on a Windows Host post App Deployment

Agent dlls are not picked because of aspNetCore inProcess hostingModel. hostingModel should be OutOfProcess and only then agent was loaded correctly. 


aspNetCore line from web.config:

<aspNetCore processPath="dotnet" arguments=".\WebApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess">

Now everything works correctly!






Re: How to deploy the .NET Core Agent on a Windows Host post App Deployment

Since I resolved the issue in my test environment I set it up in production environment and another issue rise up. Agents are correctly registered to controller but no trasanction are discovered. :( 


Any ideas?