Fixing 500 Internal Server in Windows Server
It’s very frustrating when we hosting our web application in windows server and suddenly server throw 500 internal server. What’s more frustrating is when hosting provider’s takes lot of time to resolve it. Sometimes they just say there is some problem in our own code which causing this error.
Most of the times, this error is faced by PHP developers when they host their web application in windows servers. The simple and best solution I found in internet which also helped me a lot times is to set debug mode true in web.config file. When we get any error, first we need to debug it before we reset it. Debugging is required because we come to it know for which reason we face errors.
In Windows server we can turn on/off debug using web.config file. Simply add the following lines of code to your web config file.
<configuration>
<system.webServer>
<httpErrors errorMode=”Detailed” />
<asp scriptErrorSentToBrowser=”true”/>
</system.webServer>
<system.web>
<customErrors mode=”Off”/>
<compilation debug=”true”/>
</system.web>
</configuration>
Save it and upload to the server and the server throws the exact reason of error instead of 500 internal server which helps us to fix problem.
Whenever the problem is resolved, the error is automatically removed and executes the application.
If you find any other ideas to resolve issues, then keep sharing here in comments, best one will be added in the blog. Happy Sharing!!