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.

Note

The .NET Core SDK package contains a native shared library oboe_<major>_<minor>_<patch>.dll for Windows platforms and oboe_<major>_<minor>_<patch>.so for Linux platforms. At runtime, the .NET Core SDK must be able to find and load the native shared library and its dependencies.

On Windows platforms, the .NET Core Runtime looks for this shared library under the <published-dotnet-core-app>/runtimes/win-x64/native/ or <published-dotnet-core-app>/runtimes/win-x86/native/ directory depending on if the application is 64 bit or 32 bit. If the location of this runtime directory is changed, then the PATH environment variable must be updated with the new location.

On Linux platforms, the .NET Core Runtime looks for this shared library under the <published-dotnet-core-app>/runtimes/linux-x64/native/ or <published-dotnet-core-app>/runtimes/linux-x86/native/ directory depending on if the application is 64 bit or 32 bit. If the location of this runtime directory is changed, then the LD_LIBRARY_PATH environment variable must be updated with the new location. See the troubleshooting page for more details.

Adding the AppOptics.Instrumentation ASP.NET Middleware

The .NET Core SDK provides an ASP.NET Core middleware which can be added to your ASP.NET Core application to automatically start traces and report metrics.

To use it, add the line app.UseAppopticsApm(); to the Startup.cs file in your ASP.NET Core project. See the Startup.cs example below:

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

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

Note

The AppOptics middleware needs to intercept the request before it is processed by the first MVC middleware, so should be added before the first MVC middleware in Startup.cs. See ASP.NET Core middleware order for more information on how order is defined and its implications.

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. In a standard evironment the log files are:

  • Linux - /var/tmp/appoptics/DotNetAgentLog*
  • Windows - C:\Windows\TEMP\AppOptics\DotNetAgentLog*

Azure App Service

The .NET Core SDK can be used to instrument your application running in App Service on Linux and Windows; follow the same steps described on this page to install and optionally add the ASP.NET middleware. The service key can be configured as an App Service application setting APPOPTICS_SERVICE_KEY or in the agent.config file. Note that custom Docker container deployment for App Service requires certain base images which are not yet supported by the .NET Core SDK.

In the App Service environment, the SDK log files can be found under these directories which you can access via the SSH/Debug console:

  • Linux - /home/LogFiles/AppOptics
  • Windows - D:\home\LogFiles\AppOptics