title: HttpClient.GetAsync unable to connect to the remote server
body: <p>I have a Windows 8.1 application running on a Windows 10 Enterprise tablet. This app is calling an ASP.NET RESTful Web API running on a remote server. The Web API is using Windows Authentication. I have Fiddler installed on the tablet and I can make calls into the Web API so that proves the Web API is available to the outside world.</p>
  
  <p>Here is the code I use to make the call:</p>
  
  <pre><code>if (WebApiAuthClientHandler == null)
  {
     WebApiAuthClientHandler = new HttpClientHandler()
     {
        Credentials = CredentialCache.DefaultNetworkCredentials,
        ClientCertificateOptions = ClientCertificateOption.Automatic
     };
  }
  
  if (WebApiHttpClient == null)
  {
     WebApiHttpClient = new HttpClient(WebApiAuthClientHandler)
     {
        BaseAddress = new Uri(_serviceUri, UriKind.Absolute),
        Timeout = new TimeSpan(0, 0, 150)
     };
  
     WebApiHttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  }
  
  HttpResponseMessage response = await WebApiHttpClient.GetAsync("api/user", HttpCompletionOption.ResponseContentRead).ConfigureAwait(continueOnCapturedContext: false);
  
  var userLoginInfo = await response.Content.ReadAsAsync&lt;UserLoginInformation&gt;();
  </code></pre>
  
  <p>where WebApiAuthClientHandler and WebApiHttpClient are my class' static members.</p>
  
  <p>The _serviceUri is constructed from the app's settings and results in a nicely formatted absolute URI like "<a href="http://10.120.4.0:5000" rel="nofollow">http://10.120.4.0:5000</a>".
  Like I said, if I issue a GET HTTP command with Fiddler to the URL "<a href="http://10.120.4.0:5000/api/user" rel="nofollow">http://10.120.4.0:5000/api/user</a>" I get the expected response on my tablet.</p>
  
  <p>The problem is that my GetAsync call throws an exception after about 21 seconds. It is not timeout, because, as you can see, I set the timeout to 150 seconds (I know it's too much, but for now I was just trying to eliminate all potential causes).
  The exception thrown is of type HttpRequestException and the several nested messages inform me that I was "Unable to connect to the remote server" because "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 127.0.0.1:8888"</p>
  
  <p>This last part really puzzles me because I do not try to access the Web API locally but remotely, having passed the proper remote URL address.</p>
  
  <p>This issue it's been bugging me for close to two weeks and I still have no resolution to it. Any suggestion would be highly appreciated.</p>
  
  <p>TIA,
  Eddie</p>