title: Web server received an invalid response while acting as a gateway or proxy server
body: <p>When trying to deploy a web application to Azure using a service account with the Google .net client library it is returning with the following error</p>
  
  <blockquote>
    <p>502 - Web server received an invalid response while acting as a
    gateway or proxy server.</p>
  </blockquote>
  
  <p>Code example:</p>
  
  <pre><code>var certificate = new X509Certificate2(KeyFilePath, "notasecret", X509KeyStorageFlags.Exportable);
  
  ServiceAccountCredential credential = new ServiceAccountCredential(
      new ServiceAccountCredential.Initializer(serviceAccountEmail) {
                          Scopes =  new string[] { AnalyticsService.Scope.Analytics };
                      }.FromCertificate(certificate));
  
  // Create the service.
  AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer()
                  {
                      HttpClientInitializer = credential,
                      ApplicationName = "Analytics API Sample",
                  });
  </code></pre>
  
  <p>The code above works when run in development.  However when deployed to AZURE it returns an error. </p>