title: Random 500 errors on IIS
body: <p>I have been working on an application that provides some web services to a client. The MVC application is built on .Net 4.5 framework. Everything worked fine until we looked at the response statistics our client had generated, where we could see we weren’t responding 100%. The statistics showed response drop to 90%-95% every other day.</p>
  
  <p><strong>Inspecting the logs</strong></p>
  
  <p>The first thing I did was to check our application log where I couldn’t find any exceptions logged. We log all (unhandled) exceptions in our application, which would normally lead to an error HTTP status code, so finding no such exception made me think that the request has not reached the application at all. The next step was to check the IIS access logs and there I could not find any 500 errors. I was under the impression that something is going on with the network which is causing 500's.
  Upon further investigation, I realized those are being generated by IIS server. I found this by setting up Failed Request Tracing on IIS and after a while I found following error logged:</p>
  
  <blockquote>
    <p>ModuleName - ManagedPipelineHandler Notification -
    EXECUTE_REQUEST_HANDLER HttpStatus - 500 HttpReason - Error Retrieving
    Data HttpSubStatus - 0 ErrorCode -The operation completed
    successfully. (0x0)</p>
  </blockquote>
  
  <p>I've looked at various stackoverflow posts but nothing really helped me. I guess it is because of no of requests we make per minute around 200 requests per minute). But I get response for 90-95% requests.</p>
  
  <p><a href="https://i.stack.imgur.com/gCg8S.png" rel="nofollow noreferrer">Attached detailed error log here</a></p>