Install .NET Core SDK

Getting the .NET Core SDK

The .NET Core SDK can be added to your project using the AppOptics.Instrumentation nuget package. In addition to the AppOptics.Instrumentation .NET Core assemblies, the nuget package also includes some dependent libraries and the agent.config file that contains configuration options.

  • Add the AppOptics.Instrumentation nuget package to your .NET Core project.
  • The service key must be configured in the agent.config file. The agent.config file is included in the AppOptics.Instrumentation nuget package. Alternatively, the service key can be set using the environment variable APPOPTICS_SERVICE_KEY.
  • After adding the nuget package to your project you can add the AppOptics.Instrumentation ASP.NET Middleware (see below) or add SDK methods <../sdk> to your application to start traces, report spans and custom metrics or both.
  • All the files in the AppOptics.Instrumentation nuget package must be deployed with your application.
  • The nuget package can also be downloaded from https://files.appoptics.com/dotnet/DotNetCoreSDK.zip

Adding the AppOptics.Instrumentation ASP.NET Middleware

The .NET Core SDK contains an ASP.NET Core Middleware which you can add to your ASP.NET Core application. The middleware will automatically start traces and report metrics.

The line app.UseAppopticsApm(); needs to be added to the Startup.cs file in your ASP.NET Core project. See Startup.cs example below:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;

public class Startup
{
    public void Configure(IApplicationBuilder app)
    {
        app.UseAppopticsApm(); // Add the AppOptics.Instrumentation Middleware
    }
}

See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware for more information on ASP.NET Core middleware.

Troubleshooting

After installing the agent if traces and metric data do not appear in the AppOptics dashboard, please review the Troubleshooting page for tips on how to resolve.

Log File Locations

The AppOptics .NET Core SDK logs detailed information about problems it runs into, which can provide helpful information during troubleshooting.

  • Records of running instrumentation are in C:\Windows\TEMP\AppOptics\DotNetAgentLog*.