title: ASP.NET Core HealthChecks reports false negative with RabbitMQ
body: <p>Using this <a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks" rel="nofollow noreferrer">Enterprise HealthChecks for ASP.NET Core Diagnostics Package</a> I'm facing an issue where the HealtChecks tells me my endpoint is unhealthy where in fact everything is working. </p>
  
  <p>The error message I'm getting now (after updating the Nuget package to 5.5.2) is </p>
  
  <pre><code>[2019-07-17 11:25:16.147 +02:00 Error] 
  [HealthChecks.UI.Core.HostedService.HealthCheckReportCollector] [] 
  GetHealthReport threw an exception when trying to get report from 
  http://url.domain/health configured with name {name}.
  
  System.Net.Http.HttpRequestException: An error occurred while sending the 
  request. ---&gt; System.IO.IOException: Unable to read data from the transport 
  connection: An existing connection was forcibly closed by the remote host. --- 
  &gt; System.Net.Sockets.SocketException: An existing connection was forcibly 
  closed by the remote host
  </code></pre>
  
  <p>And  </p>
  
  <pre><code>[2019-07-17 11:25:16.482 +02:00 Error] 
  [MassTransit.RabbitMqTransport.Transport.RabbitMqReceiveTransport] [] RabbitMQ 
  Connect Failed: "Operation interrupted"
  </code></pre>
  
  <p>My Startup configuration: </p>
  
  <pre class="lang-cs prettyprint-override"><code>public void Configure(
              IApplicationBuilder app,
              IHostingEnvironment env)
          {
              app.UseHealthChecks("/health", new HealthCheckOptions
              {
                  Predicate = check =&gt; true,
                  ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
              }).UseHealthChecksUI(setup =&gt;
                 {
                     setup.ApiPath = "/healthchecks-api";
                     setup.UIPath = "/healthchecks-ui";
                 });
  
              app.UseMvc();
              OnServiceConfiguration(services);
          }
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>public override void OnServiceConfiguration(IServiceCollection services)
  {
      services.AddMassTransit(x =&gt;
              {
                  x.AddConsumer&lt;MailConsumer&gt;();
                  x.AddConsumer&lt;MailFailedConsumer&gt;();
  
                  x.AddBus(provider =&gt; ConfigureBus(provider, 
                                                    rabbitMqConfigurations));
              });
  
      services.AddMassTransitHostedService();
  }
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>private IBusControl ConfigureBus(
          IServiceProvider provider,
          RabbitMqSettings rabbitMqConfigurations) =&gt; 
               Bus.Factory.CreateUsingRabbitMq(
               cfg =&gt;
               {
                   var host = cfg.Host(
                                 rabbitMqConfigurations.Host,
                                 "/",
                                 hst =&gt; {
                                   hst.Username(rabbitMqConfigurations.Username);
                                   hst.Password(rabbitMqConfigurations.Password);
                                 });
  
                                 cfg.UseHealthCheck(provider);
                                 cfg.ReceiveEndpoint(host, $"{typeof(MailSent).Namespace}.{typeof(MailSent).Name}", endpoint =&gt;
                                 {
                                     endpoint.Consumer&lt;MailConsumer&gt;(provider);
                                 });
  
                                 cfg.ReceiveEndpoint(host, $"{typeof(MailSentFailed).Namespace}.{typeof(MailSentFailed).Name}", endpoint =&gt;
                                 {
                                     endpoint.Consumer&lt;MailFailedConsumer&gt;(provider);
                                 });
                              });
  </code></pre>
  
  <p><strong>When I don't use the consumers the HealthCheck is OK</strong>. So there is a problem with the endpoints, but what? </p>