Obviously something cannot be null - but I can't figure it out. I have a windows service that is self-hosted and has an endpoint that returns a HealthCheckResult
. I then have a .Net Core Web Application that uses HealthChecks-UI
. However, when I start both of the applications up, the healthcheck-ui says my service is in a bad status, but at the same time I can hit the url on my windows service and get a healthy status.
When I look at the output I get -
Sending HTTP request GET {url}
Received HTTP response - OK
HealthCheck collector HostedService threw an error: Value cannot be null. (Parameter 'source')
To me, I'm getting a good 200 response, but something is failing. Ideally, I'd use the HealthChecks
library in my app that I want to monitor, but I can't because it's a windows service. That's why I chose to implement my own and just expose a restful, self-hosted endpoint. I'm using versions 3.1 of HealthChecks-UI
.
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecksUI()
.AddInMemoryStorage();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting()
.UseEndpoints(config =>
{
config.MapHealthChecksUI();
});
}
AppSettings.json
{
"HealthChecks-UI": {
"HealthChecks": [
{
"Name", "Windows Service", "Uri": "{myRestfulEndpoint}"
}
],
"Webhooks": []
}
}