.NET Core Setup

Requirements

  • ASP.NET Core 1.x or 2.x running on Windows

Setup instructions

1. Please refer to the instructions on creating an application in Raygun and installing Raygun APM Agent in the Setup instructions for .NET

2. Configure your .NET Core application with an API Key by going to the .NET Core tab in the Raygun Profiler Configuration tool. If your .NET Core application is running then you can select it from the process list. If your process is not listed then find the path to your process dll or exe and enter it into the assembly name field.

Configure a .NET Core process for profiling

3. With your .NET Core process selected, click the Register button and then enter your Raygun application API Key into the dialog and click Save. This will save your setting and then open the profiler configuration help screen.

Enter you API key

4. The final step to profiling a .NET Core application is to register the profiler when your application starts. There are many ways in which a .NET Core application can be started so we’ve listed some common methods along with the required environment variables needed to configure the Raygun APM profiler correctly.

This dialog can be re-opened by clicking on the Show Config button from the configuration screen.

How to configure environment variables for your process

5. To check that your application is being monitored correctly, go back to the browser on your local computer and click the Test Application button at the bottom of the instructions page. NOTE: it may take a few minutes for data to be ingested.

6. Once the application has successfully received data from APM, you will see a success message and a green button. Click View your data in APM.

Test your application: Success.

Deregistering an application

1. To stop profiling a .NET Core application you’ll first need to remove the environment variables that were configured when your application starts. Once these have been removed then restart your application to stop profiling.

2.\ The final step is to remove the API Key configuration going to the .NET Core tab in the Raygun Profiler Configuration tool. Select the configured process and click the Deregister button.

Setup using the Raygun CLI tool

Another method for registering and profiling a .NET Core application is to use the Raygun CLI tool

  1. Register your .NET Core process with the Raygun application API Key using the following command.
 # Configure HelloWorldApp.dll with an API Key
 rgc.exe -enable HelloWorldApp.dll -type dotnetcore -apikey xxx -startup 30 -norecycle
  1. To start the process and automatically configure the correct environment variables you can bootstrap the execution of your .NET Core process using the following command.
 # Start HelloWorldApp.dll process with profiler environment configured
 rgc.exe -profile "%ProgramFiles%\dotnet\dotnet.exe" -arguments HelloWorldApp.dll -coreclr