title: Getting The remote server returned an error: (504) Gateway Timeout for WebAPI
body: <p>I am using below code to make an API call from my C# code with WebRequest:</p>
  <pre><code>public object GetData() 
  {
   object response = &quot;&quot;;
   string token = &quot;EF232354&quot;;
   string baseUrl = ConfigurationManager.AppSettings[&quot;BaseURL&quot;].ToString();
   string endPoint = ConfigurationManager.AppSettings[&quot;EndPoint&quot;].ToString();
  
   var httpWebRequest = (HttpWebRequest) WebRequest.Create(baseUrl + endPoint);
  
   httpWebRequest.ContentType = &quot;application/json&quot;;
   httpWebRequest.Method = HttpVerb.GET.ToString();
   httpWebRequest.Headers.Add(&quot;token&quot;, token);
  
   var httpResponse = (HttpWebResponse) httpWebRequest.GetResponse();
   Stream dataStream = httpResponse.GetResponseStream();
   StreamReader reader = new StreamReader(dataStream);
  
   using(JsonReader sdr = new JsonTextReader(reader)) 
   {
    JsonSerializer serializer = new JsonSerializer();
    response = serializer.Deserialize(sdr);
   }
    return response;
  }
  </code></pre>
  <p>Sometimes I am getting:</p>
  <blockquote>
  <p>Message: The remote server returned an error: (504) Gateway Timeout.</p>
  <p>Exception Type: System.Net.WebException</p>
  </blockquote>
  <p>And how many requests can WebRequest make at a time?</p>