title: HttpClient fails to respond after a period of time
body: <p>I have a Asp.Net Core (2.1) website using <a href="https://aspnetboilerplate.com/" rel="nofollow noreferrer">Asp.Net Boilerplate</a>.</p>
  
  <p>I'm trying to make a API call using <code>HttpClient</code>, which works locally, but throws an error when deployed to IIS. </p>
  
  <p>I created a <code>TypedClient</code></p>
  
  <pre><code>public class FormsHttpClient : IFormsHttpClient
  {
      private const string url = "my_url:3001/";
      private readonly HttpClient _client;
  
      public FormsHttpClient(HttpClient httpClient)
      {
          httpClient.BaseAddress = new Uri(url);
  
          _client = httpClient;
      }
      ....
  }
  </code></pre>
  
  <p>In my <code>startup.cs</code> file, I added: </p>
  
  <p><code>services.AddHttpClient&lt;IFormsHttpClient, FormsHttpClient&gt;();</code></p>
  
  <p>The error i get when i deploy: </p>
  
  <blockquote>
    <p>ERROR 2018-12-12 18:30:29,509 [11   ] Mvc.ExceptionHandling.AbpExceptionFilter - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
    System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---</p>
  </blockquote>
  
  <p>The network call normally takes 1800ms to finish, it seems to timeout around 21000ms.</p>
  
  <p>I came across the code <code>AppContext.SetSwitch("System.Net.Http.useSocketsHttpHandler", false);</code>, thought i wasn't sure where to put it, i tossed it in the constructor of my <code>startup.cs</code> class but it doesn't seem to have any effect.</p>
  
  <p>Is there something else im missing?</p>
  
  <p>E: The code that calls the api is in JS: </p>
  
  <pre><code>   app.forms.token = {
      generate: function () {
          Formio.logout();
          abp.services.app.forms.generateFormToken().done(function (e) {
              Formio.setToken(e);
          });
      },
      clear: function () {
          Formio.logout();
      }
  }
  </code></pre>