Help Docs

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.

The .NET Core agent should be installed to make it work since it acts as a helper API to load the agent.

Instructions

  1. Add the NuGet package into your .NET Core web application/API project.
  2. 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.
  1. Publish and deploy the application.

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.


We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.


Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!