title: AggregateException is throwing while waiting for PostAsJsonAsync
body: <p>AggregateException  is throwing while waiting for  API post to complete how i could fix this?</p>
  
  <p>My API call is similar like this    </p>
  
  <pre><code>using (var httpClient = new HttpClient())
  {
      httpClient.BaseAddress = new Uri(workflowUrl);
      var task = httpClient.PostAsJsonAsync("api/apiname/execute/", executeModel)
                               .ContinueWith(x =&gt; x.Result.Content.ReadAsAsync&lt;bool&gt;().Result);
  
      Task continuation = task.ContinueWith(x =&gt;
      {
          bool response = x.Result;
      });
      continuation.Wait(); 
  
  }
  </code></pre>
  
  <p>I am getting Exception given below while waitng for POST to complete.</p>
  
  <pre><code>  System.AggregateException was caught
    Message=One or more errors occurred.
    Source=mscorlib
    StackTrace:
         at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
         at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
         at System.Threading.Tasks.Task.Wait()
         at 
    InnerException: System.AggregateException
         Message=One or more errors occurred.
         Source=mscorlib
         StackTrace:
              at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
              at System.Threading.Tasks.Task`1.get_Result()
              at 
              at System.Threading.Tasks.Task`1.&lt;&gt;c__DisplayClass17.&lt;ContinueWith&gt;b__16(Object obj)
              at System.Threading.Tasks.Task.InnerInvoke()
              at System.Threading.Tasks.Task.Execute()
         InnerException: System.AggregateException
              Message=One or more errors occurred.
              Source=mscorlib
              StackTrace:
                   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
                   at System.Threading.Tasks.Task`1.get_Result()
                   at WebUI.ListController.&lt;ListRepeater_ItemCommand&gt;b__f(Task`1 x) in PostAsJsonAsync:line 741
                   at System.Threading.Tasks.Task`1.&lt;&gt;c__DisplayClass1a`1.&lt;ContinueWith&gt;b__19()
                   at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
                   at System.Threading.Tasks.Task.InnerInvoke()
                   at System.Threading.Tasks.Task.Execute()
              InnerException: System.Threading.Tasks.TaskCanceledException
                   Message=A task was canceled.
                   InnerException:
  </code></pre>