Connect ASP.NET Core to Bugsink
The ASP.NET Core integration reports unhandled endpoint exceptions with their route, HTTP request, and application stack.
This guide adds the integration to an existing minimal API and triggers a deliberate endpoint failure. To follow along, create a Bugsink project and copy its DSN. The quickstart guide shows where to find it.
Install the SDK
Add the open-source Sentry ASP.NET Core package to your web project. Bugsink accepts the Sentry event protocol, so the SDK can send events directly to your Bugsink project:
dotnet add package Sentry.AspNetCoredotnet add package Sentry.AspNetCore
Configure your DSN
Call UseSentry() while building the web host. Reading the DSN from the
environment keeps it out of source control:
builder.WebHost.UseSentry(options => { options.Dsn = Environment.GetEnvironmentVariable("SENTRY_DSN"); });builder.WebHost.UseSentry(options => { options.Dsn = Environment.GetEnvironmentVariable("SENTRY_DSN"); });
Set SENTRY_DSN to the DSN shown by your Bugsink project when you start the
application:
export SENTRY_DSN=https://key@bugsink.example/1export SENTRY_DSN=https://key@bugsink.example/1
Send a test error
Temporarily throw an exception in an endpoint you can request. The endpoint does not need a Bugsink-specific capture call; the integration sees the unhandled exception as it leaves the ASP.NET Core request pipeline:
if (!inventory.ContainsKey(sku)) { throw new ProductNotFoundException($"Product {sku} is not in inventory"); }if (!inventory.ContainsKey(sku)) { throw new ProductNotFoundException($"Product {sku} is not in inventory"); }
Start the application with its DSN, then request that endpoint once:
dotnet run :::bash curl http://127.0.0.1:5000/checkout/dotnet-missingdotnet run :::bash curl http://127.0.0.1:5000/checkout/dotnet-missing
The exception still follows ASP.NET Core’s normal error handling. The request returns its usual 500 response while the integration reports the failure to Bugsink.
See the error in Bugsink
Open your Bugsink project. The new ProductNotFoundException issue contains
the concrete request, the parameterized endpoint route, and the application
frame which raised it.
ProductNotFoundException
That’s it: unhandled ASP.NET Core endpoint exceptions will now be reported to Bugsink. Remove the deliberate exception; the integration remains active for future request failures.
This guide proves the Linux-hosted ASP.NET Core request pipeline. It does not yet cover .NET logging providers, desktop UI frameworks, Azure Functions, or .NET MAUI.
