Load agent using the .NET Core agent Loader API
By default, when you install an APM Insight .NET Core agent, the agent will be loaded along with the .NET dependencies configurations. However, this is not possible for self-contained applications. In such cases, you can install the .NET Core agent and load it using the agent loader API. To do so, add the loader agent API snippet in the startup file of the .NET Core application.
Instructions
- Add the NuGet package into your .NET Core web application/API project.
- Open the Program.cs file and add the snippet below.
For .NET version 5.0 and below apps, insert the line of code inside the Main() method.
For .NET version 6.0 and above apps, insert the line of code above the WebApplication.CreateBuilder() method call.
- Publish and deploy the application.