Deploying website: 500 - Internal server error

2018-12-31 03:36发布

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 got:

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

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

20条回答
长期被迫恋爱
2楼-- · 2018-12-31 04:04

I realized the permissions for the files and folders in your server also matter. I uploaded my files from a linux operating system and usually the permissions are limited for read and write. So when uploaded, the permission are still same as in the local machine.

I had the same error and i just changed the permissions for the folder i had uploaded and the error was gone.

Hope it helps someone.

查看更多
姐姐魅力值爆表
3楼-- · 2018-12-31 04:05

Sometimes, the reason might be one of your .dll assemblies is not registered correctly on the server.

For example, you can successfully run a C# Excel web application on your local machine with Office installed, while getting the 500 error on server deployment, because there is no Office suite installed on the server, and thus you get the server error.

查看更多
琉璃瓶的回忆
4楼-- · 2018-12-31 04:06

Server Error 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. Goddady. Hosting - Web - Economy - Windows Plesk

In my case, I replace this code:

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

Then change framework 3.5 to framework 4. It shows my detailed error. I delete code in:

<httpModules></httpModules>

It solved my problem.

查看更多
无与为乐者.
5楼-- · 2018-12-31 04:10

For those who have this possibility (VPS hosting not web hosting):

Connect to your hosting server via Remote Desktop. Open Web Browser from your remote desktop and you will see the detail description of the error.

You don't need to modify web.config or expose any details to anybody else.

查看更多
浮光初槿花落
6楼-- · 2018-12-31 04:11

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

查看更多
明月照影归
7楼-- · 2018-12-31 04:13

My first attempt to publish and then run a very simple site serving only HTML produced "The page cannot be displayed because an internal server error has occurred."

The problem: I had the site set to .NET 3.5 in Visual Studio (right click web site project -> Property Pages -> Build), but had the Web Site in Azure configured as .NET 4.0. Oops! I changed it to 3.5 in Azure, and it worked.

查看更多
登录 后发表回答