Jakub Jedryszek Jakub Jedryszek - 1 month ago 16
ASP.NET (C#) Question

Deploying website: 500 - Internal server error

I am trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this:


Server Error

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.


After fiddling around with the web.config, I now get:


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


How can I see the actual issue behind this server error?

Answer

First, you need to enable and see detailed errors of your web messages, because this is a general message without giving information on what's really happening for security reasons.

With the detailed error, you can locate the real issue here.

Also, if you can run the browser on the server, you get details on the error, because the server recognizes that you are local and shows it to you. Or if you can read the log of the server using the Event Viewer, you also see the details of your error.

On IIS 6

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

On IIS 7

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

Note: You can avoid the Debug=true. You only need to close the custom errors for a while and get the detailed error page.

Reference: Enabling Windows custom error messaging in Go Daddy's help articles.

Also, this can help: How to enable the detailed error messages (from IIS).