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

For IIS 8

<system.web>
   <customErrors mode="Off" />
</system.web>
<system.webServer>
   <httpErrors existingResponse="PassThrough" errorMode="Detailed">
</system.webServer>

Turn off IIS8 custom errors by Raul

查看更多
看淡一切
3楼-- · 2018-12-31 04:18

If you are using IIS 8.5 it may be that you need to change the ApplicationPool ID setting from ApplicationPoolId to NetworkService

Right click the Application Pool in question, click on "Advanced Settings" and then scroll down to ID - it will probably be set to ApplicationPoolIdentity. Click the button (..) and select NetworkService from the dropdown list instead.

Also make sure that if it is a .NET 2.0 application that you are not referencing the 4.0 framework in your App Pool.

查看更多
刘海飞了
4楼-- · 2018-12-31 04:19

For me, the following code in the web.config was the culprit. When I removed it, the web site worked fine.

  <staticContent>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  </staticContent>
查看更多
笑指拈花
5楼-- · 2018-12-31 04:19

In my case, I put a mistake in my web.config file. The application key somehow was put under the <appSettings> tag. But I wonder why it doesn't display a configuration error. The error 500 is too generic for investigating the problem.

查看更多
皆成旧梦
6楼-- · 2018-12-31 04:19

In addition to the other suggestions, make sure to change the existingResponse attribute of the httpErrors node to Auto from Replace, or to remove that property entirely.

<httpErrors existingResponse="Replace" />
                              ^^^^^^^ not going to work with this here
查看更多
低头抚发
7楼-- · 2018-12-31 04:21

I was pulling my hair out over this issue. Making sure the following entry was in the root web.config file fixed it for me:

<configuration>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>
</configuration>

Remember that you have to add this to the existing XML elements, if they're already there. You can't just add at the end of the file, because you can't have multiple copies of any element.

查看更多
登录 后发表回答