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

progproger picture progproger · Jun 9, 2015 · Viewed 124.6k times · Source

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

Answer

mike nelson picture mike nelson · Feb 13, 2016

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