312
CHAPTER 7 | Implement resilient applications
Implement health checks in ASP.NET Core services
When developing an ASP.NET Core microservice or web application, you can use the built-in health
checks feature that was released in ASP .NET Core 2.2
(
Microsoft.Extensions.Diagnostics.HealthChecks
). Like many ASP.NET Core features, health checks
come with a set of services and a middleware.
Health check services and middleware are easy to use and provide capabilities that let you validate if
any external resource needed for your application (like a SQL Server database or a remote API) is
working properly. When you use this feature, you can also decide what it means that the resource is
healthy, as we explain later.
To use this feature effectively, you need to first configure services in your microservices. Second, you
need a front-end application that queries for the health reports. That front-end application could be a
custom reporting application, or it could be an orchestrator itself that can react accordingly to the
health states.
Dostları ilə paylaş: