Working past 500–Internal server error

So you’ve written a new ASP.Net website, tested it locally in your development environment and you deploy it to your IIS server.  Now you’re getting the dreaded 500 – Internal server error.  What are you to do?

image

As you may know, a HTTP 500 error is a generic error message returned by a web server when it knows something has gone wrong but it is unable to be more specific about the error.  That’s not necessarily helpful, though, when you are trying to figure out what is causing the error so you can fix it and get your web site to load.  Here are a few tips to help you find the real error so you can get your site loading properly.

Classic ASP

If you are running Classic ASP on IIS 7 or IIS 8, just about any error that you get from an out-of-the-box installation will be a 500 error.  You should check out this blog post for more information on developing Classic ASP applications in IIS 7 or later.

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:
  3. <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. 

  4. 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.
  5. Look in Event Viewer.  Sometimes you can find the detailed error logged in there, particularly Application Event Viewer.
  6. 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.
  7. 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.

This list isn’t meant to provide a comprehensive repository of ways you can find the real error behind a 500 Internal Server Error, rather a guide of ideas to help get you started.  I will continue to update this post as I come across more scenarios.

Rick is a Senior Support Lead at OrcsWeb, a hosted server company providing managed hosting solutions.

No Comments