How to implement health checks in ASP.Net Core

Source: InfoWorld

Take advantage of health check middleware in ASP.Net Core to monitor the health of your application, its database connection, and more

Health checks are used to determine if the application is responding to requests normally. ASP.Net Core provides support for health checks for reporting the health of an application using health check middleware, which was introduced in ASP.Net Core 2.2.

Health checks in ASP.Net Core are exposed as HTTP endpoints and are configurable. You can use health checks to do a basic check for liveness, to check system or network resources, to check whether the database is responding, or to check on other dependencies such as a message broker or an Azure cloud service. This article presents a discussion of how we can work with the health check middleware in ASP.Net Core.

Create an ASP.Net Core project in Visual Studio

First off, let’s create an ASP.Net Core project. If Visual Studio 2017 is up and running in your system, follow the steps given below to create a new ASP.Net Core project in Visual Studio.

  1. Launch the Visual Studio 2017 IDE.

  2. Click on File > New > Project.

  3. Select “ASP.Net Core Web Application (.Net Core)” from the list of the templates displayed.

  4. Specify a name for the project.

  5. Click OK to save the project.

  6. A new window “New .Net Core Web Application…” is shown next.

  7. Select .Net Core as the runtime and ASP.Net Core 2.2 (or later) from the drop-down list at the top.

  8. Select API as the project template.

  9. Ensure that the check boxes “Enable Docker Support” and “Configure for HTTPS” are unchecked as we won’t be using those features here.

  10. Ensure that “No Authentication” is selected as we won’t be using authentication either.

  11. Click OK.

Pentechs've been excellent and a pleasure to work with.  Despite the complexity of the project they've delivered a superb result and kept all their promises.

CEO, Digiclips, UK

See what our clients say

Want to start a project?

Contact us at

+91 886 110 9173

+91 997 289 6003

+91 80 4200 7229