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

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

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

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


当前回答

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

异常信息:

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.

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

其他回答

实际上,当我托管我的web应用程序时,我发现你在本地机器上开发的代码比托管公司提供的版本更高。如果您有管理权限,您可以更改Microsoft ASP。web主机设置下的NET版本支持

也有可能在某些情况下。配置格式不正确。在这种情况下,你必须一行一行地检查它才能工作。通常情况下,重写规则是罪魁祸首。

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

一定要加上 就在system。web之后

我把它放在节点的末尾,但没有工作。

我刚刚处理过类似的问题。在我的情况下,默认的网站asp.net版本是1.1,而我试图启动一个2.0的web应用程序。错误是非常微不足道的,但它不是立即清楚为什么自定义错误不会消失,运行时从来没有写到事件日志。显而易见的修正是匹配Asp中的版本。IIS的Net选项卡。