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

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

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

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


当前回答

对我来说,这是网络上的一个错误。在system.web上面配置。

文件blah不存在,所以它会抛出一个错误。因为它还没有进入系统。Web部分,但它正在使用服务器的默认设置CUstomErrors (On)

其他回答

如果可以访问事件查看器,通常可以在它中找到有关错误的更多信息。您的提供者也可能通过在其机器中覆盖自定义错误来完全阻止自定义错误的显示。config,或者将retail属性设置为true (http://msdn.microsoft.com/en-us/library/ms228298(VS.80).aspx)。

“Off”区分大小写。

检查“O”在你的网页中是否是大写的。配置文件,我已经遭受了几次(简单,因为它听起来)

在过去的几天里,这已经把我逼疯了,无法回避,但最终还是弄明白了:

在我的机器里。我在<system.web>下有一个条目:

<deployment retail="true" />

这似乎覆盖了你在web中指定的任何其他customError设置。配置文件,因此将上述条目设置为:

<deployment retail="false" />

现在意味着我可以再次看到我需要的详细错误消息。

这台机器。配置位于

32位

%windir%\Microsoft.NET\Framework\[version]\config\machine.config

64位

%windir%\Microsoft.NET\Framework64\[version]\config\machine.config

我尝试了这里描述的大部分方法。我用的是VWD和默认网页。配置文件包含:

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
        <error statusCode="403" redirect="NoAccess.htm" />
        <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>

我将mode="RemoteOnly"更改为mode="Off"。还是不高兴。 然后我使用IIS管理器,属性,ASP。Net选项卡,编辑配置,然后选择CustomeErrors选项卡。仍然显示RemoteOnly。我将其更改为Off,最后我可以看到详细的错误消息。

当我浏览网页的时候。我看到在system.web中有两个CustomErrors节点;我刚刚注意到第二个条目(我正在更改的条目是在注释中)。所以尽量不要用记事本来检查网页。远程服务器上的配置。

但是,如果你使用IIS编辑配置的东西,它会抱怨web.config中的错误。然后你就可以排除所有关于"你的web.config中是否有XML语法错误"的答案

我也遇到过同样的问题,我查看了事件查看器应用程序日志,其中清楚地提到了发生这种情况的异常。在我的情况下,例外如下…

异常信息:

Exception type: HttpException 
Exception message: The target principal name is incorrect.  Cannot generate SSPI context.
at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

The target principal name is incorrect.  Cannot generate SSPI context.

我刚刚在应用程序池中更新了我的密码,它为我工作。