Skip to content

Instantly share code, notes, and snippets.

@a-patel
Created November 3, 2021 13:18
Show Gist options
  • Save a-patel/fecb574de0c75291fb88600449e02b26 to your computer and use it in GitHub Desktop.
Save a-patel/fecb574de0c75291fb88600449e02b26 to your computer and use it in GitHub Desktop.
Health Checks in ASP.NET and ASP.NET Core
public void ConfigureServices(IServiceCollection services)
{
...
services.AddHealthChecks();
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
// ASP.NET Core 2.2
app.UseHealthChecks("/health");
// ASP.NET Core 3.x and later version
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
});
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment