Install the .NET Core SDK
Get 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.
-
Set the service key in the
agent.config
file included in the AppOptics.Instrumentation NuGet package. See .NET Core SDK configuration for more information on the location of this file.This is a separate configuration file from the one installed with the .NET Agent.
Alternatively, the service key can be set using the environment variable
APPOPTICS_SERVICE_KEY
. -
After adding the NuGet package to your project you can use the ASP.NET middleware or SDK methods in your application to start traces, and report spans and custom metrics.
-
All the files in the AppOptics.Instrumentation NuGet package must be deployed with your application.
-
The NuGet package for Windows platforms can also be downloaded from https://files.appoptics.com/dotnet/DotNetCoreSDK.zip
-
The NuGet package for Linux platforms can also be downloaded from https://files.appoptics.com/dotnet/dotnet-core-package.tgz
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.
The middleware is only required if you are not using the .NET Agent for Linux.
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();
}
}
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
When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with the other integrated experiences' products. How you navigate AppOptics and access its features may vary from these instructions. For more information, go to the APM Integrated Experience documentation.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.