title: Debugging 400 Bad Request response
body: <p>In my MVC application, when a POST request is sent to the server (via jQuery) and a validation error occurs, a 400 Bad Request is returned, as intended:</p>
  
  <pre><code>HTTP/1.1 400 Bad Request
  Cache-Control: private
  Content-Type: application/json; charset=utf-8
  Server: Microsoft-IIS/8.5
  X-AspNet-Version: 4.0.30319
  Date: Thu, 26 Feb 2015 08:35:50 GMT
  Content-Length: 174
  
  {"ReturnValue":null,"Results":[{"Message":"The xyz field is required.","ErrorNumber":123,"Severity":1}]}
  </code></pre>
  
  <p>This works as intended on my local machine. However when I deploy the application to the server, the response for the exact same request looks different:</p>
  
  <pre><code>HTTP/1.1 400 Bad Request
  Cache-Control: private
  Content-Type: text/html
  Server: Microsoft-IIS/7.5
  X-AspNet-Version: 4.0.30319
  Date: Thu, 26 Feb 2015 08:37:01 GMT
  Content-Length: 24
  
  Invalid Request
  </code></pre>
  
  <p>Note that the content type is <code>text/html</code>, and the response body doesn't contain JSON anymore.</p>
  
  <p>What could be the cause of this? I would appreciate a pointer where to start debugging.</p>