title: HttpClient Hangs on GetAsync for ERR_CONNECTION_REFUSED
body: <p>I am attempting to get the status of a website in a .NET Core 3.1 worker service <code>await client.GetAsync</code> is only hanging on ERR_CONNECTION_REFUSED from the host </p>
  
  <p>Program.cs</p>
  
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
                  Host.CreateDefaultBuilder(args)
                 .UseWindowsService()
                 .ConfigureServices((hostContext, services) =&gt;
                      {
                          services.AddHostedService&lt;Worker&gt;();
                          services.AddHttpClient();
                      });
  </code></pre>
  
  <p>Worker Constructor </p>
  
  <pre><code>   public Worker(ILogger&lt;Worker&gt; logger, IConfiguration configuration, IHttpClientFactory clientFactory)
      {
          _logger = logger;
          _configuration = configuration;
          _clientFactory = clientFactory;
      }
  </code></pre>
  
  <p>And later in the worker in the ExecuteAsync method. </p>
  
  <pre><code>var client = _clientFactory.CreateClient();
  var Siteresult = await client.GetAsync(_siteAdress);
  </code></pre>
  
  <blockquote>
    <p>ERR_CONNECTION_REFUSED from the server is the only way we can get this failing. The worker does not recover, We replicate this by
    turning off the site in IIS (when we turn off the app pool we get a
    helpful 503 and works well) we browse to the site in chrome and get
    ERR_CONNECTION_REFUSED but the worker just hangs.</p>
  </blockquote>