title: PostAsync HttpClient error with Web Api - System.AggregateException "A task was canceled."
body: <p>I'm trying to call PostAsync method using System.Net.Http.HttpClient from the Web API. I get the following error:</p>
  
  <blockquote>
    <p>System.AggregateException "A task was canceled."</p>
  </blockquote>
  
  <p>Task:</p>
  
  <blockquote>
    <p>Id = 1, Status = System.Threading.Tasks.TaskStatus.Canceled, Method = "{null}", Result = "{Not yet computed}"</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>using (HttpClientHandler handler = new HttpClientHandler())
  {
      handler.Credentials = new NetworkCredential("MyUsername", "p@ssw0rd");
  
      using (HttpClient client = new HttpClient(handler))
      {
          var postData = new List&lt;KeyValuePair&lt;string, string&gt;&gt;();
          postData.Add(new KeyValuePair&lt;string, string&gt;("status", "Hello world"));
  
          HttpContent content = new FormUrlEncodedContent(postData);
  
          var responseTask = client.PostAsync(url, content).ContinueWith(
              (postTask) =&gt;
              {
                  postTask.Result.EnsureSuccessStatusCode();
              });
      }
  </code></pre>
  
  <p>I assume the responseTask will force the method to run synchronously?</p>
  
  <p>It's a WPF application, not ASP.NET.</p>