title: How to Get Detailed Error Message From IIS 7.5 While Consuming MVC 4 WebAPI Restful Service?
body: <p>Assume I have a working Method in a Controller.  Pseudo code could be: </p>
  
  <pre><code>public IEnumerable&lt;ViewMP3&gt; MyMP3(string token, string id)
  { 
  using (ControlDbContext db = new MyDbContext())
  { List&lt;ViewMP3&gt; list = ...some list linq statement
  
  return list;
  }}
  </code></pre>
  
  <p>I consume the WebAPI using HttpClient and no error is produced.
  Now, suppose I throw an error on purpose:
      throw new ArgumentException("hello"); //inserted in method above</p>
  
  <p>How can I get a real detailed error message.  All I can get is IIS 7.5 Detailed Error - 500.0 - Internal Server Error.  Note:  not to confuse the issue, I pass the error output of the WebAPI service back to the client in a string.  The error is originating inside the service but will only produce the 500.0 error.  Normally JSON is returned but when a known error condition is set, I change my code to grab the response in a string format and pass on to the client.  That is how I know what the error contains.</p>
  
  <p>I have tried enabling "Send Errors to Browser".  I have changed IIS Error Pages Feature Settings to Detailed Errors.  I have changed Web.Config to include </p>
  
  <pre><code>&lt;customErrors mode="Off" /&gt;
  &lt;compilation debug="true" targetFramework="4.0" /&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;httpErrors errorMode="Detailed"&gt;
  &lt;remove statusCode="500" subStatusCode="-1" /&gt;
  &lt;/httpErrors&gt; .
  </code></pre>
  
  <p>I have granted IIS_IUSRS rights to the folder with the web files.</p>
  
  <p>I had a real error earlier in the day that was nearly impossible to troubleshoot because of the generic 500.0 error.  Any idea what else I could do to get detailed error messages?</p>
  
  <p>Thanks!</p>