0

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": []
   }
}
Nkosi
  • 235,767
  • 35
  • 427
  • 472
Brandon
  • 3,074
  • 3
  • 27
  • 44

1 Answers1

0

Assuming you are using AspNetCore.Diagnostics, check this github issue (particularly this comment). It looks like you are having the same issue listed (it wasn't able to find the configuration file without setting HostDefaults.ContentRootKey in the WebHostBuilder).

Connor Low
  • 5,900
  • 3
  • 31
  • 52
  • Interesting. That did make a difference, but now instead of getting the ```Value cannot be null``` error, I get a ```Object not set to an instance``` error. – Brandon Jan 04 '21 at 23:30