I'm trying to use the .NET Core 2.2 Health Checks.
In ConfigureServices I registered my class that implements the Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck interface.
But when I execute the UseHealthChecks extension method inside the Configure method, it throws an error:
public void Configure(IApplicationBuilder app)
{
app.UseHealthChecks("/hc"); // <-- Error in this line
// ...
System.InvalidOperationException: 'Unable to resolve service for type 'Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckService' while attempting to activate 'Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckMiddleware'