.NET implementation of the APIs available at Healthchecks.io
dotnet add package NHealthCheck
Search for NHealthCheck in your package manager of choice.
This package is built with dependency injection in mind. It's recommended to register it first (Native):
builder.Services.AddHttpClient<IHealthCheckService,HealthCheckService>();or (Autofac):
varservices=newServiceCollection();services.AddHttpClient<IHealthCheckService,HealthCheckService>();builder.Populate(services);The simplest use is to call the success method when your job finishes:
publicclassMyJob{privateIHeathCheckServiceHealthCheckService{get;}publicMyJob(IHealthCheckServicehealthCheckService){HealthCheckService=healthCheckService;}publicTaskDoWork(){
...
await HealthCheckService.SuccessAsync(newGuid(config.HealthCheckGuid));}}