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

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

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

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


当前回答

“Off”区分大小写。

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

其他回答

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

我在这里找到了一个解决这个问题的答案:https://stackoverflow.com/a/18938991/550975

只要把这个添加到你的web.config:

<configuration>  
  <system.webServer>  
    <httpErrors existingResponse="PassThrough"/>  
  </system.webServer>  
<configuration>

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

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

异常信息:

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.

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

这真的很奇怪。我得到这个错误,重新启动我的服务器后,它消失了。