title: MVC 6 WebAPI returning html error page instead of json version of exception object
body: <p>I am calling an api endpoint in an MVC 6 WebAPI:</p>
  
  <pre><code>POST http://localhost:57287/mytestapi/testentity/ HTTP/1.1
  Accept: application/json
  X-APIKey: 00000000-0000-0000-0000-000000000000
  Content-Type: application/json; charset=utf-8
  Host: localhost:57287
  Content-Length: 1837
  Expect: 100-continue
  Connection: Keep-Alive
  </code></pre>
  
  <p>In the body I have json serialized test entity.</p>
  
  <p>I have a bug in my entity controller code and the api is returning a 500 response 'Server Error' I know what the bug is an will fix it, however the issue I need some help with is that the API is returning HTML instead of the json serialized exception object - Json is what I expect: it's what the old webapi would return.  I have ported the coded from an old test project that I know works.</p>
  
  <p>So why is MVC 6 WebAPI returning html rather than json?  Is there some configuration I need to do?</p>
  
  <p>EDIT: 
  I added Accept: application/json to headers as suggested by @danludwig, however this did not resolve the issue, I still got an html error page back. </p>
  
  <p>I looked at my StartUp.cs and found:</p>
  
  <pre><code>if (env.IsDevelopment())
  {
      //app.UseBrowserLink();
      app.UseDeveloperExceptionPage();
  }
  else
  {
      app.UseExceptionHandler("/Home/Error");
  }
  </code></pre>
  
  <p>in the ConfigureApp method.  I tested with app.UseDeveloperExceptionPage(); commented out.  This prevented the return of the html error page in the api response body,  however I am still not getting the json serialised exception object.</p>