Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The page cannot be displayed because an internal server error has occurred on server

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

like image 291
progproger Avatar asked Jun 09 '15 11:06

progproger


People also ask

How do you fix the page Cannot be displayed because an internal server error has occurred?

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.

What does it mean the page Cannot be displayed because an internal server error has occurred?

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.

What does internal server error has occurred mean?

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 .


2 Answers

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". "

like image 21
Eric Barr Avatar answered Oct 15 '22 14:10

Eric Barr


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" /> 
like image 197
mike nelson Avatar answered Oct 15 '22 15:10

mike nelson