title: Why do I get a server timeout calling an API via HttpClient but Postman is fine?
body: <p>I am trying to make a <code>GET</code> request to a RESTful service but the .NET <code>HttpClient</code> is receiving a timeout, but via Postman this returns an expected response (an error response, since I'm not yet &quot;logged in&quot;) within seconds.</p>
  <h1>What I've tried:</h1>
  <ol>
  <li>I have checked the URLs are the same and they are.</li>
  <li>I thought perhaps Postman's automagical headers are the issue, but after setting these in the <code>HttpClient</code> I still receive a timeout.</li>
  <li>If I increase the timeout on the <code>HttpClient</code> I still get a timeout from the server (<code>(504) Gateway Timeout</code>).</li>
  </ol>
  <pre class="lang-cs prettyprint-override"><code>Client = new HttpClient(new HttpClientHandler()
  {
      AutomaticDecompression = System.Net.DecompressionMethods.GZip
  });
  var objTask = Client.GetStringAsync(objUrl);
  objTask.Wait();
  strResponse = objTask.Result;
  strResponse = Client.GetStringAsync(objUrl).Result;
  </code></pre>
  <p>Why am I receiving a timeout via HttpClient?</p>
  <h1>Note:</h1>
  <p>Our WebApi is calling our WCF Service, which in turn is calling the 3rd party RESTful service via HttpClient---for security reasons I can't call the 3rd party API directly from our WebApi controller. The website is based on the .NET 4.0 Framework.</p>