I've installed website on my local machine using IIS 7 successfully. But when I've deployed it on live server, I got the following error:
"The page cannot be displayed because an internal server error has occurred" Nothing else.
Using the same IIS 7 on live and also set to have Detailed errors
in Error Pages module, but still getting the same. What can be a reason?
Thanks
The page cannot be displayed because an internal server error has occurred. If running on Azure, have a look at site slots. You should warm up the pages on a staging slot before swapping it to the production slot.
When a error is 500, that means it's an internal error, meaning internal to the service - the service threw an exception that was not caught. Look in the Windows event logs on the server to see what went wrong. Also, try: - Go to menu Tools/Internet Options in your IE.
When you hit an internal server error it usually means some parts of your web server is not configured correctly or the application is trying to do something and the server is failing to carry out the request due to a conflict or restriction. This error can only be resolved by fixes to the Web server software .
I think the best first approach is to make sure to turn on detailed error messages via your web.config file, like this:
<configuration> <system.webServer> <httpErrors errorMode="Detailed"></httpErrors> </system.webServer> </configuration>
After doing this, you should get a more detailed error message from the server.
In my particular case, the more detailed error pointed out that my <defaultDocument>
section of the web.config file was not allowed at the folder level where I'd placed my web.config. It said
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". "
I just got this error and it was caused by a duplicate static content MIME type in the web.config
This error was being returned only on static files - eg images, css, js files were all saying this error (text by itself, no other html or text in the response).
The way to debug this is to look in web config under static content. Here we have a json file extension loaded. This was required on IIS7 but will kill the app if used on IIS8 because json is now pre-loaded at the server level.
<staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" /> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent>
So solution is to remove any of these mimeType entries one at a time to confirm which are needed and which kill your app!
Update
Actually the best solution was provided by a commenter here. You can remove and then add, which will always work regardless of whether it is already defined or not. Like this:
<remove fileExtension=".json" /> <mimeMap fileExtension=".json" mimeType="application/json" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With