title: How do I determine what is the issue with a 500 error on a HttpClient.PostAsJsonAsync call?
body: <p>I am making a call to a Web API that I wrote. I am working through the bugs on both sides and am getting a 500 error. I want to see that is in that error message to see what might be the problem. How do I find that?</p>
  
  <pre><code>using (var client = new HttpClient())
  {
      var fooURL = Url.RouteUrl("PayrollApi", new { httproute = string.Empty, controller = "LeaveRequest" }, Request.Url.Scheme);
      var repsonse = client.PostAsJsonAsync(fooURL, leaveRequest).Result;
  }
  </code></pre>
  
  <p>I don't see where that text might be stored so I can figure out what other bugs need to be fixed. How do I get that text?</p>
  
  <p><strong>Update</strong>: something I didn't clarify. I put a breakpoint on the WebAPI I am calling and the break point is never hit. <em>However</em>, when I call it from Poster, I hit the break point. The URL is correct.</p>
  
  <pre><code>public HttpResponseMessage Post([FromBody]LeaveRequest value)
  {
      if (ModelState.IsValid)
      {
          // code here
      }
  }
  </code></pre>