cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Ashish.Singh
AppDynamics Team

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?

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

  1. 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. Screen Shot 2018-08-03 at 5.35.57 PM.png

  2. 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.
    Screen Shot 2018-08-03 at 6.27.50 PM.png

  3. 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"
     }
    }

     

  4. 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}" />​

     

  5. 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.​

     

  6. 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-->

  7. Restart your hosted application. Your app will instrument through the agent and report data to the configured Controller.
Comments
AppDynamicsAgentLog.config now works after upgrade from nuget agent version 4.5.13.0 to 4.5.14 Previously all .net core nuget agent logs go to the default folder and file names, C:\ProgramData\AppDynamics\DotNetAgent and it was mixed with logs from normal .Net agent for Windows
pauric.coyle
Producer

where is the location of the AppDynamics core agent profiler ?

Ashish.Singh
AppDynamics Team

AppDynamics.Profiler_x64.dll and AppDynamics.Profiler_x86.dll are the profiler dlls, which you place in the common folder location or application folder to instrument the .NET Core based applications.

Also, it can be the anywhere only thing you just need to set the path in the following environment variables "CORECLR_PROFILER_PATH_64" or "CORECLR_PROFILER_PATH_32"

For rexamplee -  

<environmentVariable name="CORECLR_PROFILER_PATH_64" value=".\AppDynamics.Profiler_x64.dll" />

pauric.coyle
Producer

for example : 

 

<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="D:\Websites\staging\FINACPI_OPTEST\AppDynamics.Profiler_x64" />
<environmentVariable name="CORECLR_PROFILER_PATH_86" value="D:\Websites\staging\FINACPI_OPTEST\AppDynamics.Profiler_x86" />
</environmentVariables>
<environmentVariables />

Ashish.Singh
AppDynamics Team

Yes, It looks correct.

FYI - If the configured location "D:\Websites\staging\FINACPI_OPTEST", is not your project location, kindly give the full access to the user identity under which your application is running/application pool is configured.

Harrison.Clark
Builder

What about for a .NET Core console application? There's no web.config in a console app to set the environment variables. Where should I be setting the environment variables in that scenario?

Ashish.Singh
AppDynamics Team

Hi Harrison,

You can add these Environment variables at the system level. Let me know if you have any questions for this.

Chetan.Goyal
Discoverer

Hi,

 

We tried instrumenting this today but it did not work. It only started working when we changed the name of Config file to AppDynamicsConfig.json instead of <APP>.AppDynamicsConfig.json.

 

For example,

We see only one line below in profiler logs with App.AppDynamicsConfig.json and we don’t see the agent reporting.

2020-04-22 13:18:45.444095[0x00001cc4]<info>:Use CoreCLR profiler

 

However, when we change the config file name to AppDynamicsConfig.json, it reads successfully and starts reporting and we see logs growing.

2020-04-22 13:24:20.859515[0x000045d4]<info>:Use CoreCLR profiler

2020-04-22 13:24:20.861510[0x000045d4]<info>:Should instrument standalone profiler process (config found at C:\inetpub\wwwroot\<APP Path>\AppDynamicsConfig.json): w3wp as app w3wp.exe

2020-04-22 13:24:20.862518[0x000045d4]<info>:Successfully read file.

 

We are using 4.5.18.1 version of the .Net core microservice agent.

 

Although it is working, the problem we have is whenever we deploy the application, it automatically changes the name of the config to <APP>.AppDynamicsConfig.json and we have to change it back again.

 

Any recommendation around that?

 

Regards,

Chetan

 

 

 

 

 

Claudia.Landivar
Community Manager

@Chetan.Goyal — I spoke with @Ashish.Singh  and he had a couple of suggestions to relate.

 

If it is working with AppDynamicsConfig.json and not <APP>.AppDynamicsConfig.json, it seems you might be using .NET Core Framework 2.2 or above, for which this is expected behavior.

 

You mentioned that it is re-converting to <APP>.AppDynamicsConfig.json after deployment. you might look at which NuGet package and version you're are using as this reconversion after deployment should not occur with the latest NuGet version. 

 

If this doesn't help, @Ashish.Singh  recommends you open a Support ticket so the issue can be further investigated by the correct team.

 

Claudia Landivar

Community Manager & Editor

kinley.jasser
Wanderer

Hi @Ashish.Singh,@Claudia.Landivar  /Appdynamics team,

 

I have followed the steps that are mentioned in this article to instrument .net core application with app dynamics .net core microservices.

 

I can able to load the profiler with "AppDynamicsConfig.json" not <APP>.AppDynamicsConfig.json.

 

profiler.JPG

 

But I can't able to get the metrics, transactions, and node details on the controller side.

 

Note: I can able to get the transactions on the controller side for .net applications.

 

Here are the below agent.log details, Please help me in solving the issue earliest.

 

Info ConfigurationChannel Sending Registration request with: Application Name ***, Tier Name GlobeEx, Node Name ****, Host Name **** Node Unique Local ID ***, Version 21.5.1 compatible with 4.4.1.0
2021-08-02 18:53:13.6107 17712 ******1 67 Warn ConfigurationChannel Could not connect to the controller/invalid response from controller, cannot get initialization information, controller host [******.saas.appdynamics.com], port[***], exception [System.Exception: Connection back off limitation in effect: https://****************.saas.appdynamics.com:***/controller/instance/0/applicationConfiguration_PB_]
2021-08-02 18:53:13.6107 17712 *********1 67 Error ConfigurationChannel Exception: Connection back off limitation in effect: https://**********.saas.appdynamics.com:****/controller/instance/0/applicationConfiguration_PB_ Exception: System.Exception: Connection back off limitation in effect: https://********.saas.appdynamics.com:****/controller/instance/0/applicationConfiguration_PB_

Warn ConfigurationChannel Could not connect to the controller/invalid response from controller, cannot get initialization information, controller host [******.saas.appdynamics.com], port[****], exception [System.Exception: Failed to execute request to endpoint [https://******.saas.appdynamics.com:**/controller/instance/0/applicationConfiguration_PB_]. For more details if needed please set trace level for logger [com.appdynamics.REST.RESTProtobufCommunicator]
---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.

 

Ashish.Singh
AppDynamics Team

Hi kinley.jasser,

 

Based on the shared error message as below - 

 

 

Spoiler

Warn ConfigurationChannel Could not connect to the controller/invalid response from controller, cannot get initialization information, controller host [******.saas.appdynamics.com], port[****], exception [System.Exception: Failed to execute request to endpoint [https://******.saas.appdynamics.com:**/controller/instance/0/applicationConfiguration_PB_]. For more details if needed please set trace level for logger [com.appdynamics.REST.RESTProtobufCommunicator]
---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.

It seems like any one of the credentials or Controller details that you have entered while connecting the Agent to the Controller is not correct.
Could you please re-validate the Controller HOST, Account Name, Account Access Key, etc, and then check if it helps?

 

Thanks,

Ashish.

 

edited for clarity | Claudia Landivar, Community Manager

Claudia.Landivar
Community Manager

Thanks for the update, @Ashish.Singh

 

@kinley.jasser, we look forward to learning whether Ashish's suggestion helped resolve this issue. Please post and let us know your experience!

Hello,

I have a .NET 5 WebApi

I've installed, the AppDynamics.Agent.Windows  package following the instructions.
It seems to be picking the profiler dlls but I get a single log with the following message:

 [0x000034e0]<info>:Use CoreCLR profiler.

Any help you can give me is welcome. Thanks in advance!

Sarabjit.Tatra
AppDynamics Team

@Maximiliano.Guillen  - Starting with .Net msi agent version 20.3.x, the .NET Agent MSI installer for Windows now includes support for .NET Core applications, enabling unified management of .Net Core and full framework applications on Windows. The agent monitors .NET Core applications for IIS out of the box, if automatic IIS mode is configured. So we would recommend to install the latest 21.x agent and validate the behavior.

  • The MSI Installer bundles .NET Core agent with the existing .NET framework agent and creates appropriate environment variables. 
  • Supported environments are identical to the previous .NET Agent. 
  • .NET Core versions 2.0 and later are supported.
  • IIS-hosted .NET Core applications are monitored similar to the .NET frameworks configured in automatic mode
  • You can configure .NET Core applications in the config.xml file, just as you would configure .NET framework applications. 

You have to manually configure .NET Core applications in the config.xml file in either of the following scenarios:

 

  • You monitor ASP .NET core applications that are not hosted in-process, but are hosted in dotnet.exe
  • You currently monitor standalone applications

 

So can you remove the Micro Services agent related configuration and try instrumenting with latest MSI agent available on download.appdynamics.com for the respective .net core sites. Make sure to configure the sites manually in config.xml and provide same tier and node names so that it should start reporting under the same node. Also make sure at system level CORECLR_PROFILER is needed to be set to "AppDynamics.AgentProfiler" for msi agent to instrument the .net core applications. 

 

Please restart Appdynamics Coordinator Service and following that please restart IIS and apply fresh load on the applications and let us know the behavior ?

 

Let us know if you still face any issues.

Version history
Last update:
‎08-10-2021 10:44 AM
Updated by: