title: C# HttpClient.PostAsync doesn't return or throw an error
body: <p>I have a Windows service making an HTTP POST request. The REST endpoint is working and it was tested separately. After calling <code>PostAsync</code>, the debugger doesn't continue or throw an error. What would be the possible issues which cause this behavior? Following is the code snippet sending the POST request,</p>
  <p><strong>EDIT: I've changed this to async-await and used <code>ConfigureAWait</code>, but this didn't solve the problem. I need to know what is causing the function to not return any value.</strong></p>
  <pre><code>HttpClientHandler handler = GetCookieHandler();
  using(HttpClient client = new HttpClient(handler)) {
      client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;basic&quot;, accessToken);
  
      client.DefaultRequestHeaders.Add(&quot;UniqueId&quot;, _configReader.UniqueId);
  
      SetRequestCookie(handler);
  
      string jsonContent = JsonConvert.SerializeObject(content);
  
      HttpResponseMessage response = client.PostAsync(url, new StringContent(jsonContent, Encoding.UTF8, &quot;application/json&quot;)).Result;
  
      SaveCookie(handler, response.RequestMessage.RequestUri);
  
      if (response.StatusCode == HttpStatusCode.Unauthorized) {
          var customerJsonString = response.Content.ReadAsStringAsync().Result;
  
          Error data = JsonConvert.DeserializeObject &lt; Error &gt; (customerJsonString);
  
          switch (data.ErrorCode) {
          case AccessTokenValidationCodes.ExpiredOrInvalidDateTime:
              logger.Warn(&quot;Expired AccessToken&quot;);
              break;
  
          default:
              break;
          }
      }
  
      if (response.StatusCode == HttpStatusCode.Unauthorized) {
          logger.Error(&quot;Request :{0}, AccessToken {1}  response Unauthorized&quot;, apirUrl, accessToken);
          return null;
      }
      if (response.StatusCode == HttpStatusCode.InternalServerError) {
          logger.Warn(&quot;Request response InternalServerError&quot;);
          return null;
      }
      return response;
  }
  </code></pre>