Documentation forSolarWinds Observability

Install the .NET Library on Azure App Service

Application Insights must be disabled to use the SolarWinds Observability extension.

The .NET Library provides detailed insight and distributed tracing for .NET Framework and .NET Core/5+ applications running in Azure App Service. The .NET Library can be installed using the SolarWinds Observability Azure Site Extension or using the SolarWindsAPM.Agent NuGet package.

Install the .NET Library using the SolarWindsAPM Azure AppServices Site Extension (Windows only)

The .NET Library site extension supports .NET Framework aspnet|v4.8 runtime and .NET Core/5+ Azure App Services.

To install the SolarWinds Observability .NET Library SolarWindsAPM Azure AppServices Site Extension Package in your Azure Web App:

  1. In the Development Tools section of the Azure Web App, click Extensions.

  2. Click the Add button and select SolarWindsAPM Azure AppServices Site Extension from the list.

  3. To configure the .NET Library, navigate to the Application Settings in the configuration settings. Add the following application global environment variables:

    .NET Core/5+

    Environment variable Environment variable value
    SW_APM_SERVICE_KEY  

    (Optional) This overrides what is set in the solarwinds_apm.config file. 

    The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

    It should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

    SW_APM_HOME_DOTNET D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM  
    CORECLR_ENABLE_PROFILING 1
    CORECLR_PROFILER {AAAA7777-11FE-4F94-8EDA-312C0EDF4141}
    CORECLR_PROFILER_PATH_32 D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM\x86\solarwinds_apm_profiler.dll
    CORECLR_PROFILER_PATH_64 D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM\x64\solarwinds_apm_profiler.dll

    .NET Framework

    Environment variable  Environment variable value 
    SW_APM_SERVICE_KEY  

    (Optional) This overrides what is set in the solarwinds_apm.config file. 

    The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

    It should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

    SW_APM_HOME_DOTNET   D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM
    COR_ENABLE_PROFILING   1
    COR_PROFILER   {AAAA7777-11FE-4F94-8EDA-312C0EDF4141}
    COR_PROFILER_PATH_32   D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM\x86\solarwinds_apm_profiler.dll
    COR_PROFILER_PATH_64   D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM\x64\solarwinds_apm_profiler.dll
    COMPLUS_LoaderOptimization 1

    The .NET Library is installed in the D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM directory.

    For both .NET Core/5+ and .NET Framework applications, log files can be found in D:\home\LogFiles\SolarWinds.

  4. Set the Service key in the D:\home\SiteExtensions\SolarWindsAPM.Agent.AzureAppServices.Extension\SolarWindsAPM\solarwinds_apm.config file. Alternatively, the Service key can be set using the environment variable SW_APM_SERVICE_KEY.

    During an extension upgrade, the solarwinds_apm.config file is replaced with a new file and any changes made to the solarwinds_apm.config file are lost. Before upgrading the extension, back up the solarwinds_apm.config file to another location. After upgrading, the solarwinds_apm.config file can be restored by replacing the new solarwinds_apm.config file with the backed up copy.

  5. Restart the Web App application.

Uninstall the .NET Library from Azure AppServices

To disable the .NET Library instead of uninstalling the library, see Disable the .NET Library.

To uninstall the .NET Library from the Azure AppServices:

  1. From the Azure Web App, remove the .NET Library environment variables that were previously added. Navigate to the Application Settings in the configuration settings and remove the following environment variables:
    • .NET Core/5+
      • SW_APM_HOME_DOTNET
      • CORECLR_ENABLE_PROFILING
      • CORECLR_PROFILER
      • CORECLR_PROFILER_PATH_32
      • CORECLR_PROFILER_PATH_64
    • .NET Framework
      • SW_APM_HOME_DOTNET
      • COR_ENABLE_PROFILING
      • COR_PROFILER
      • COR_PROFILER_PATH_32
      • COR_PROFILER_PATH_64
      • COMPLUS_LoaderOptimization
  2. Restart the Web App application.
  3. In the Azure Web App, in the Development Tools section, click Extensions.
  4. Select the SolarWindsAPM Azure AppServices Site Extension, and click the Delete button.

Install the .NET Library using the SolarWindsAPM.Agent NuGet package (Windows and Linux)

The .NET Library NuGet package supports .NET Framework aspnet|v4.8 runtime and .NET Core/5+ Azure App Services.

  1. Open the official SolarWindsAPM.Agent NuGet package page to view details about the latest release of the library, and add the library using your preferred package installation method.

    To add the library to your package using the .NET command line, enter the following at the command line:

    dotnet add ProjectName.csproj package SolarWindsAPM.Agent --version VersionNumber

    Replace ProjectName with your project's file name and VersionNumber with the latest available version number found on the official SolarWindsAPM.Agent Nuget package page.

  2. Publish the Web App to Azure. The following is an example of a publish command:

    dotnet publish ProjectName.csproj /p:PublishProfile='ProfileName'

    Where ProjectName is your project's file name and ProfileName is a unique name to represent the publish profile.

  3. To configure the SolarWinds Observability .NET Library, navigate to the Application Settings in the configuration settings. Add the following application global environment variables:

    For Windows

    .NET Core/5+

    Environment variable  Environment variable value 
    SW_APM_SERVICE_KEY  

    (Optional) This overrides what is set in the solarwinds_apm.config file. 

    The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

    It should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

    SW_APM_HOME_DOTNET  

    D:\home\site\wwwroot\SolarWindsAPM

    CORECLR_ENABLE_PROFILING   1
    CORECLR_PROFILER   {AAAA7777-11FE-4F94-8EDA-312C0EDF4141} 
    CORECLR_PROFILER_PATH_32   D:\home\site\wwwroot\SolarWindsAPM\x86\solarwinds_apm_profiler.dll
    CORECLR_PROFILER_PATH_64   D:\home\site\wwwroot\SolarWindsAPM\x64\solarwinds_apm_profiler.dll

    For .NET Core/5+ applications, the .NET Library is installed in the following location: D:\home\site\wwwroot\SolarWindsAPM.

    For both .NET Core/5+ and .NET Framework applications, log files can be found in D:\home\LogFiles\SolarWinds.

    .NET Framework

    Environment variable  Environment variable value 
    SW_APM_SERVICE_KEY  

    (Optional) This overrides what is set in the solarwinds_apm.config file. 

    The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

    It should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

    SW_APM_HOME_DOTNET   D:\home\site\wwwroot\bin\SolarWindsAPM 
    COR_ENABLE_PROFILING   1 
    COR_PROFILER   {AAAA7777-11FE-4F94-8EDA-312C0EDF4141}
    COR_PROFILER_PATH_32   D:\home\site\wwwroot\bin\SolarWindsAPM\x86\solarwinds_apm_profiler.dll
    COR_PROFILER_PATH_64   D:\home\site\wwwroot\bin\SolarWindsAPM\x64\solarwinds_apm_profiler.dll
    COMPLUS_LoaderOptimization 1

    For .NET Framework applications, the .NET Library is installed in the %HOME% directory (typically D:\home\) in the following location: D:\home\site\wwwroot\bin\SolarWindsAPM. Log files can be found in D:\home\LogFiles\SolarWinds.

    For Linux

    Environment variable  Environment variable value 
    SW_APM_SERVICE_KEY  

    (Optional) This overrides what is set in the solarwinds_apm.config file. 

    The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

    It should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

    SW_APM_HOME_DOTNET   /home/site/wwwroot/SolarWindsAPM 
    CORECLR_ENABLE_PROFILING   1  
    CORECLR_PROFILER   {AAAA7777-11FE-4F94-8EDA-312C0EDF4141} 
    CORECLR_PROFILER_PATH   /home/site/wwwroot/SolarWindsAPM/solarwinds_apm_profiler.so  

    The .NET Library is installed in the following location: /home/site/wwwroot/SolarWindsAPM. Log files are in /home/LogFiles/SolarWinds.

  4. Set the Service key in one of the following locations or using the environment variable SW_APM_SERVICE_KEY:

    • Linux: /home/site/wwwroot/SolarWindsAPM/solarwinds_apm.config
    • Windows .NET Framework: D:\home\site\wwwroot\bin\SolarWindsAPM\solarwinds_apm.config
    • Windows .NET Core/5+: D:\home\site\wwwroot\SolarWindsAPM\solarwinds_apm.config
  5. Restart the Web App application.

Disable the .NET Library

To disable the .NET Library:

  1. In the Azure Web App, navigate to the Application Settings in the configuration settings.

  2. Set the application global environment variables:

    • For .NET Core/5+, set CORECLR_ENABLE_PROFILING to 0.

    • For .NET Framework, set COR_ENABLE_PROFILING to 0.

  3. Restart the Web App application.

To re-enable the .NET Core/5+ library, set the application global environment variable CORECLR_ENABLE_PROFILING to 1 and restart the Web App application.

To re-enable the .NET Framework library, set the application global environment variable COR_ENABLE_PROFILING to 1 and restart the Web App application.

Use the .NET SDK

The SolarWindsAPM.Agent NuGet package includes the custom instrumentation SDK, which can be used to get extra insight into components currently not covered by auto-instrumentation. To use the SDK, add the SolarWindsAPM.Agent NuGet Package to your project and follow the previous instructions to use the package with the Azure App Service. The package makes the custom SDK methods available to create additional trace spans. If the SolarWindsAPM.Agent package is deployed with your service, the SolarWindsAPM.Agent.AzureAppServices.Extension package does not need to be used.

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.