Services.AddHealthChecks() // Registers health check services
Public void ConfigureServices(IServiceCollection services) If you just want your app to report it's liveness, just use the most basic ASP.NET Core 2.2 health check in your Startup.cs. Readiness tests mean it's there but perhaps isn't ready to serve traffic. Liveness failures mean the site is down, dead, and needs fixing. You also need to distinguish between a "liveness" test and a "readiness" test. Is my disk full? Is my CPU hot? You get the idea.
If one is down I could used cached data but my site is less than "Healthy," and I'd like to know. Is your database up? Maybe it's up but in read-only mode? Are your dependent services up? If one is down, can you recover? For example, I use some 3rd party back-end services that might be down. That could be as simple as "Healthy" or "Unhealthy" or it could be a whole JSON payload that tells you what's working and what's not. You can make these tests more robust by actually having the health check endpoint check deeper and then return something meaningful. Recently folks have been formalizing their health checks.
For the longest time most site availability tests are just basic pings. You likely have a service that does an occasional GET request to a page and looks at the HTML, or maybe just looks for an HTTP 200 Response. I've wanted to make my Health Endpoint Monitoring more formal. I have tests that ping my website from all over the world and alert me if the site is down or unavailable. Once I had it updated I wanted to take advantage of some of the new features.įor example, I have used a number of "health check" services like elmah.io,, or Azure's Availability Tests. ASP.NET Core 2.2 is out and released and upgrading my podcast site was very easy.