Publishing ASP.NET Core 2.2 health check results to elmah.io

We just published a new integration between ASP.NET Core and elmah.io. As you already know, elmah.io comes with excellent support for ASP.NET Core. With the latest addition, integrating ASP.NET Core 2.2 health checks with elmah.io requires a few lines of code only. If you are not already familiar with health checks, I recommend you to read our guide ASP.NET Core 2.2 Health Checks Explained.

Back already? This means that you are now a true health checks expert and ready for the awesomeness to come. Health checks enables a much better approach to verify that your websites are working, compared to pinging the front page every 5 minutes. But, before putting health checks into production, you want to be able to monitor when your website starts complaining. elmah.io to the rescue!

To start monitoring your health check results, install the Elmah.Io.AspNetCore.HealthChecks NuGet package:

Install-Package Elmah.Io.AspNetCore.HealthChecks -IncludePrerelease

If you haven't already, enable health checks in your Startup.cs file:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services
        .AddHealthChecks()
        .AddElmahIoPublisher("API_KEY", new Guid("LOG_ID"));
    ...
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    ...
    app.UseHealthChecks("/health");
    ...
}

Notice the call to the AddElmahIoPublisher-method, which is where the magic happens really. You probably also want to add custom checks using the AddCheck-method (as described in the guide), but I've excluded this for now.

Elmah.Io.AspNetCore.HealthChecks automatically picks up failing health checks and publish them to the log specified in the LOG_ID parameter. Your existing email subscriptions and apps will notify you when your website doesn't work as intended. The new package also works perfectly with an uptime monitoring service like Pingdom or elmah.io Uptime Monitoring.

Features steps
We monitor your websites

We monitor your websites

We monitor your websites for crashes and availability. This helps you get an overview of the quality of your applications and to spot trends in your releases.

We notify you

We notify you

We notify you when errors starts happening using Slack, HipChat, mail or other forms of communication to help you react to errors before your users do.

We help you fix bugs

We help you fix bugs

We help you fix bugs quickly by combining error diagnostic information with innovative quick fixes and answers from Stack Overflow and social media.

See how we can help you monitor your website for crashes Monitor your website