Diagnose a 500 Internal Server Error on IIS

Tips for finding the real error

    1. Run the site directly on the server – depending on the configuration of your site/server, you may be able to see the real error if you load the site from a browser located on the same server.  You may need to turn off ‘show friendly http errors.’
    2. Temporarily add the following within the appropriate tags in your web.config file:
<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
    <system.web>
        <customErrors mode="Off" />
        <compilation debug="true" />
    </system.web>
</configuration>

After you have added those, load the page again to see if you can get a more detailed error.

  1. Open up IIS Manager and try to open up some of the different features by clicking on the icon.  If there is an error in the web.config file and it can’t even parse it, sometimes you will get a helpful error in IIS Manager when you try to open a feature.
  2. Look in Event Viewer.  Sometimes you can find the detailed error logged in there, particularly Application Event Viewer.
  3. Setup Failed Request Tracing.  This will often give you details on the 500 error.  This is especially helpful if it is an intermittent 500 error.
  4. Look through the web log files.   This is especially helpful for an intermittent 500 error.  You can often parse the log files to see if there is a trend with a specific page that is throwing a 500 error.

 

Source: https://blogs.iis.net/rickbarber/working-past-500-internal-server-error