MojoPortal: 500 – Internal Server Error
Written by Ian McIntosh Monday, 5 December 2011
I recently encountered a 500 internal server error that took me a while to get to the bottom of, so I thought I would blog about it. The 500 error is a generic error message that can be displayed for many reasons, this article talks about one specific cause of the error message.
Firstly I will explain the symptoms I saw and how I resolved the issue. Then I will go on to explain how I managed a more helpful error message which may be useful if you encounter a similar, but not the same, issue.
When I first published a new local website, I navigated to the homepage only to be greeted with the error ‘500 Internal Server Error’. When I tried to open control panel, I found that too was crashing, with the above error.
I checked my remote web.config & user.config files and they were fine. I contacted live chat and was told the problem was with my web.config.
In fact, it turned out the problem was that I had ASP version set to 2 not 4. When I first setup the website in control panel, I did set it to ASP 4, but I changed tab to turn on Web Deploy without first pressing the apply button – so my changes to ASP version were lost but I thought I had successfully made the change.
Now control panel was crashing, so I could not use it to change the ASP version setting.
To stop control panel crashing, I commented out the section of web.config for <system.web.extensions> as it was only this section that caused a problem. This wouldn’t make my website work, but it did stop control panel from crashing so I could fix the real problem.
An alternative would be to temporarily rename the real web.config and replace it with a very basic one such as this:
<?xml version=”1.0″ encoding=”UTF-8″?>
<directoryBrowse enabled=”true” />
<add value=”Default.htm” />
<add value=”Default.asp” />
<add value=”index.htm” />
<add value=”Default.cshtml” />
<add value=”index.php” />
<add value=”index.html” />
<add value=”index.pl” />
<add value=”default.html” />
<add value=”index.cshtml” />
<add value=”Default.aspx” />
I then navigated to control panel ( cp.mydomain.com ) and to Web | Web Sites, clicked on my website, this brings up the website properties dialog from which I selected the extensions tab, from there I selected ASP 4.0 (integrated) and pressed the update button.
With this done, I then put my web.config file back as it was and everything was fine.
Note that this crash was not only affecting the website with the wrong ASP version, it was also causing a 500 error on all websites on my account. So, if this doesn’t resolve your problem check the ASP version of all your websites.
This left me thinking, what happens if in future I get a similar issue where all I’m getting is a ‘500 – Internal Error’ message and no hint as to the cause, so I set about trying to get a better error message.
What I found was that if I replaced my web.config with the basic one so I could access control panel, selected Web | Web Sites to display the website properties dialog and went to the extensions page, then in another browser window switched back to the real web.config, went back to the control panel page and pressed update, it would now show me an error message.
I presume this error message must go into a log somewhere, but i couldn’t find it. Maybe someone could be kind enough to post a comment of where to find it?