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

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

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

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

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


当前回答

服务器错误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>

它解决了我的问题。

其他回答

确保您的帐户使用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.

如果您正在使用IIS 8.5,可能需要将ApplicationPool ID设置从ApplicationPoolId更改为NetworkService

右键单击有问题的应用程序池,单击“高级设置”,然后向下滚动到ID——它可能会被设置为ApplicationPoolIdentity。单击按钮(..)并从下拉列表中选择NetworkService。

此外,如果是. net 2.0应用程序,请确保在应用程序池中没有引用4.0框架。

服务器错误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自定义错误

Before changing the web.config file, I would check that the .NET Framework version that you are using is exactly (I mean it, 4.5 != 4.5.2) the same compared to your GoDaddy settings (ASP.Net settings in your Plesk panel). That should automatically change your web.config file to the correct framework. Also notice that for now (January '16), GoDaddy works with ASP.Net 3.5 and 4.5.2. To use 4.5.2 with Visual Studio it has to be 2012 or newer, and if not 2015, you must download and install the .NET Framework 4.5.2 Developer Package. If still not working, then yes, your next step should be enabling detailed error reporting so you can debug it.