我正在尝试部署一个ASP。网络应用程序。我已经将网站部署到IIS,但当用浏览器访问它时,它显示给我这个:

服务器错误 500 -内部服务器错误。 您正在查找的资源有问题,无法显示。

在摆弄了网页之后。配置,我得到:

由于内部服务器错误,页面无法显示。

我如何才能看到这个服务器错误背后的实际问题?


当前回答

尝试在Debug模式下编译(在Visual Studio中)。如果您处于发布模式,许多URL重写错误将不可用。

图为Visual Studio中的调试选择组合框

其他回答

确保您的帐户使用IIS 7。有关详细信息,请参见自定义Windows主机托管帐户上的IIS设置。 请按照Windows IIS 7托管帐户上更改管道模式的说明进行操作。选择“集成管道模式”。 在“项目参考”部分中,将以下程序集的“本地复制”设置为“True”:

System.Web.Abstractions
System.Web.Helpers
System.Web.Routing
System.Web.Mvc
System.Web.WebPages

将以下程序集添加到项目中,然后将“本地复制”设置为“True”:

Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Publish your application.

对于那些有这种可能性的人(VPS托管而不是网络托管):

通过远程桌面连接到托管服务器。从远程桌面打开Web浏览器,您将看到错误的详细描述。

你不需要修改web。配置或暴露任何细节给任何人。

我最近遇到了同样的问题,服务器上的磁盘空间已满。清理一些空间解决了这个问题。

服务器错误500 -内部服务器错误。 您正在查找的资源有问题,无法显示。Goddady。主机-网络-经济- Windows Plesk

在我的例子中,我替换了以下代码:

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

然后将框架3.5更改为框架4。它显示了我的详细错误。我删除代码在:

<httpModules></httpModules>

它解决了我的问题。

对于iis10,除了更改customErrors=Off来显示错误内容外,还有一个额外的步骤要做。

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

Raul在这个链接中回答了这个问题:关闭IIS8自定义错误