← All platforms

ASP.NET Core error tracking

A controller or a minimal API. Either can throw. Sentry’s ASP.NET Core integration sends the error reports to Telebugs on your server.

~/hoofnotes  dotnet add package Sentry.AspNetCore
~/hoofnotes  nvim Program.cs
using Sentry;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseSentry(options =>
{
// Copy the complete Telebugs DSN, key and path included.
options.Dsn = "YOUR_TELEBUGS_DSN";
});
var app = builder.Build();
// Remove this test route after checking Telebugs.
app.MapGet("/telebugs-test", () =>
{
SentrySdk.CaptureException(
new InvalidOperationException("Hello from Hoof Notes"));
return "Check Telebugs for the test report";
});
app.Run();
~/hoofnotes  dotnet run -- --urls http://localhost:5000

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep Sentry.AspNetCore. Point it at your Telebugs DSN and keep reporting errors as before. The reports go to your server; you don’t need a Sentry account.

Minimal APIs or MVC controllers?

Both. The integration connects to ASP.NET Core’s request handling. An unhandled exception can become a report without adding a capture call to each endpoint.

Can I report an error and keep the request going?

Yes. Use SentrySdk.CaptureException for exceptions you handle yourself. It works in plain .NET applications, too.