0

I am setting up the HealthCheckUI for the ASPNETCore web api (.Net Core 3.1). However http://localhost:1234/healthchecks-ui keeps calling the default api http://localhost:1234/healthchecks-api instead of http://localhost:1234/health as configured.

The /health returns JSON data as expected and /healthchecks-api returns [].

enter image description here

Any idea please?

Setup:

public void ConfigureServices(IServiceCollection services){
   ...
   services.AddHealthChecksUI(setupSettings: setup=> 
            {
                setup.SetEvaluationTimeInSeconds(15); //time in seconds between check
                setup.MaximumHistoryEntriesPerEndpoint(60); //maximum history of checks
                setup.SetApiMaxActiveRequests(1); //api requests concurrency

                setup.AddHealthCheckEndpoint("api", "/health"); //map health check api
            })
            .AddInMemoryStorage();
}

and

public void Configure(IApplicationBuilder app){
   ...
   app.UseEndpoints(endpoints =>
            {
                endpoints.MapHealthChecks("/health", new HealthCheckOptions { ResponseWriter = HealthCheckResponseWriter.WriteAsync });
                endpoints.MapHealthChecksUI();

            });
}
beewest
  • 4,486
  • 7
  • 36
  • 63

1 Answers1

1

My HealthCheck JSON is not good format. Working fine with the default UIResponseWriter:

endpoints.MapHealthChecks("/health", new HealthCheckOptions { ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse });
beewest
  • 4,486
  • 7
  • 36
  • 63