Getting Started

For an overview of what Sentry does, take a look at the Sentry workflow.

Sentry is designed to be both simple to get off the ground and powerful to grow into. If you have never used Sentry before, this tutorial helps you get started.

Getting started with Sentry is a three step process:

  1. Sign up for an account
  2. Install your SDK
  3. Configure your SDK

Install an SDK

Sentry captures data by using an SDK within your application’s runtime. These are platform specific and allow Sentry to have a deep understanding of how your application works.

Install the NuGet package:

Package Manager:

Install-Package Sentry.AspNetCore

.NET Core CLI:

dotnet add package Sentry.AspNetCore

Configure the SDK

After you completed setting up a project in Sentry, you’ll be given a value which we call a DSN, or Data Source Name. It looks a lot like a standard URL, but it’s actually just a representation of the configuration required by the Sentry SDKs. It consists of a few pieces, including the protocol, public key, the server address, and the project identifier.

Add Sentry to Program.cs through the WebHostBuilder:

ASP.NET Core 2.x:

Copied
public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        // Add the following line:
        .UseSentry("PUBLIC_DSN");

ASP.NET Core 3.0:

Copied
public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            // Add the following line:
            webBuilder.UseSentry("PUBLIC_DSN");
        });

Capturing your first event

Once you have Sentry integrated into your project, you probably want to verify that everything is working as expected before deploying it.

Next Steps

Now that you’ve got basic reporting set up, you’ll want to explore adding additional context to your data.

You can edit this page on GitHub.