Created
November 3, 2021 13:18
-
-
Save a-patel/fecb574de0c75291fb88600449e02b26 to your computer and use it in GitHub Desktop.
Health Checks in ASP.NET and ASP.NET Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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