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 1: Download the .NET Core agent for Windows
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
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. |
AppDynamics.Agent.dll
AppDynamics.Profiler_x64.dll
AppDynamicsAgentLog.config
AppDynamics.Agent.netstandard.dll
AppDynamics.Profiler_x86.dll
STEP 3: Setup Environment Variables for the .NET Core CLR Profiler
Environment variables are described in detail here: https://docs.appdynamics.com/display/PRO45/Install+the+.NET+Core+Microservices+Agent+for+Windows |
Click “Environment Variables…”
|
Click “New…” under “System variables” and add each of the following.
NOTE: <appd_agent_path> is the path created in STEP 2.1 above CORECLR_ENABLE_PROFILING=1 CORECLR_PROFILER={39AEABC1-56A5-405F-B8E7-C3668490DB4A} CORECLR_PROFILER_PATH_32=<appd_agent_path>\AppDynamics.Profiler_x86.dll CORECLR_PROFILER_PATH_64=<appd_agent_path>\AppDynamics.Profiler_x64.dll |
STEP 4: Configure the AppDynamics Agent
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. |
Edit the “<APP>.AppDynamicsConfig.json” file and configure as described here: https://docs.appdynamics.com/display/PRO45/AppDynamicsConfig.json+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 |
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?
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!
--
Thanks,
Dalibor
Hello Frank,
@Frank.Martens thanks for this post, this was more useful than official AppD documentation.
I made a progress but asp.net 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.
--
thanks.
Dalibor
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 1: Download the .NET Core agent for Windows
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
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. |
AppDynamics.Agent.dll
AppDynamics.Profiler_x64.dll
AppDynamicsAgentLog.config
AppDynamics.Agent.netstandard.dll
AppDynamics.Profiler_x86.dll
STEP 3: Setup Environment Variables for the .NET Core CLR Profiler
Environment variables are described in detail here: https://docs.appdynamics.com/display/PRO45/Install+the+.NET+Core+Microservices+Agent+for+Windows |
Click “Environment Variables…”
|
Click “New…” under “System variables” and add each of the following.
NOTE: <appd_agent_path> is the path created in STEP 2.1 above CORECLR_ENABLE_PROFILING=1 CORECLR_PROFILER={39AEABC1-56A5-405F-B8E7-C3668490DB4A} CORECLR_PROFILER_PATH_32=<appd_agent_path>\AppDynamics.Profiler_x86.dll CORECLR_PROFILER_PATH_64=<appd_agent_path>\AppDynamics.Profiler_x64.dll |
STEP 4: Configure the AppDynamics Agent
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. |
Edit the “<APP>.AppDynamicsConfig.json” file and configure as described here: https://docs.appdynamics.com/display/PRO45/AppDynamicsConfig.json+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 |
Hello Frank,
@Frank.Martens thanks for this post, this was more useful than official AppD documentation.
I made a progress but asp.net 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.
--
thanks.
Dalibor
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!
--
Thanks,
Dalibor
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?
User | Count |
---|---|
11 | |
4 | |
1 | |
1 | |
1 | |
1 |