ASP.NET Core Interview Question #171
What is health checking in ASP.NET Core?
Logging, Error Handling & Background Services Mid-Level Intermediate
Quick Interview Answer
Health checks expose application health information that infrastructure can use to determine whether an instance is functioning or ready to receive traffic.
Detailed Explanation
Health checks expose application health information that infrastructure can use to determine whether an instance is functioning or ready to receive traffic.
ASP.NET Core provides health-check services and endpoint mappings. Checks can represent dependencies such as databases, caches, or external services, but they should be designed carefully so health endpoints remain fast and do not overload dependencies.
Health checks are commonly separated conceptually into liveness and readiness concerns.
Code Example
builder.Services.AddHealthChecks();
var app = builder.Build();
app.MapHealthChecks("/health");
app.Run();