加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – httpErrors web.config部分阻止调试

发布时间:2020-12-15 17:21:25 所属栏目:百科 来源:网络整理
导读:我正在尝试将服务器上的所有错误重定向回我的应用程序,以便它可以显示适当的内容并可能将用户重定向到正确的位置. 当我通过它编辑错误页面时,IIS 7管理器将此部分添加到我的web.config中. httpErrors errorMode="Custom" remove statusCode="401" subStatusC
我正在尝试将服务器上的所有错误重定向回我的应用程序,以便它可以显示适当的内容并可能将用户重定向到正确的位置.

当我通过它编辑错误页面时,IIS 7管理器将此部分添加到我的web.config中.

<httpErrors errorMode="Custom">
    <remove statusCode="401" subStatusCode="-1" />
    <remove statusCode="403" subStatusCode="-1" />
    <remove statusCode="405" subStatusCode="-1" />
    <remove statusCode="406" subStatusCode="-1" />
    <remove statusCode="412" subStatusCode="-1" />
    <remove statusCode="502" subStatusCode="-1" />
    <remove statusCode="501" subStatusCode="-1" />
    <remove statusCode="500" subStatusCode="-1" />
    <error statusCode="404" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="500" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="501" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="502" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="412" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="406" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="405" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="403" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
    <error statusCode="401" prefixLanguageFilePath="" path="/ErrorPage.aspx" responseMode="ExecuteURL" />
</httpErrors>

但是现在当我尝试在ASP.Net中调试时,我收到一条错误消息. “无法在Web服务器上启动调试.有关常见配置错误,请参阅帮助.在调试器外部运行Web页面可能会提供更多信息.确保服务器运行正常.通过执行验证web.config中没有语法错误没有调试的Debug.Start.您可能还想在在线文档中引用ASP.NET和ATL Server调试主题.“无论设置是在web.config还是服务器applicationHost.config中,都会发生这种情况.

在没有调试的情况下执行Debug.Start没有提供有用的信息,该站点正常运行.

使用从web.config中删除的部分开始调试可以使其正确启动.奇怪的是,我可以在调试器启动后将此部分添加回web.config,一切都按预期工作.

我认为它发生的原因是asp.net调试器不知道IIS配置部分.继续删除此部分并重新添加它真的很痛苦.任何人都知道如何解决它?

解决方法

终于找到了合理的工作.在IIS服务器配置中设置所有内容(尽管这也适用于单独的站点).将功能设置设置为“本地请求的详细错误和远程请求的自定义错误页面”.

当我们需要调试错误页面本身时,在开始调试后将其切换为自定义错误.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读