Microsoft has been working on a health checking framework called Microsoft.AspNetCore.Diagnostics.HealthChecks, and released it as part of ASP.NET Core 2.2. It provides a standard and pluggable way to check the state of services on which your app depends. This is not a feature of ASP.NET itself, but since any complex web app normally has external dependencies, this may come in handy for checking their statuses before taking any action.
After adding the core NuGet package, you will need to add the ones for the checks that you're interested in, such as those for SQL Server. We register those in the ConfigureServices method, as follows:
services
.AddHealthChecks()
.AddCheck("Web Check", new WebHealthCheck("http://
google.com"), HealthStatus.Unhealthy)
.AddCheck("Sample Lambda", () => HealthCheckResult.Healthy
("All is well!"))
.AddDbContextCheck<MyDbContext>("My...