我得到一个错误,每次我上传我的webapp到提供商。由于使用了customErrors模式,我所看到的是默认的“运行时错误”消息,指示我关闭customErrors以查看有关错误的更多信息。

我恼怒地织好了网。配置如下所示:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

然而,我所得到的只是一个愚蠢的远程错误页面,上面没有任何有用的信息。 我还能做什么来关闭customErrors ?!


当前回答

我的问题是,我有这个定义在我的web.config

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" />
  <remove statusCode="500" />
  <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
  <error statusCode="500" responseMode="ExecuteURL" path="/Error/Internal" />
</httpErrors>

其他回答

如果你正在使用MVC预览4,你可能会遇到这种情况,因为你正在使用HandleErrorAttribute。行为在5中改变了,因此如果关闭自定义错误,它将不处理异常。

我的问题是,我有这个定义在我的web.config

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" />
  <remove statusCode="500" />
  <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
  <error statusCode="500" responseMode="ExecuteURL" path="/Error/Internal" />
</httpErrors>

在一个网站的目录树中,这个web应用程序设置在任何其他应用程序下面吗?检查所有的父网站。配置文件用于其他设置(如果有的话)。同时,将您的目录设置为IIS中的应用程序目录。

还要确保你在编辑网页。配置而不是网站。配置,正如我所做的。

对于Sharepoint 2010应用程序,您还应该编辑C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ Web。配置和定义<customErrors mode="Off" />