gpt4 book ai didi

visual-studio-2010 - 向 system.webServer.httpErrors 添加 401 自定义错误会产生 "Unable to start debugging on the web server"错误

转载 作者:行者123 更新时间:2023-12-01 06:43:14 26 4
gpt4 key购买 nike

我从一个空白的 MVC 3 Web 应用程序开始。我在本地 IIS 中为 localhost:80 创建了一个新网站,并将我的新 MVC 3 项目配置为使用该 Web 服务器而不是 VS 开发 Web 服务器。此时我可以正常运行和调试项目。但是如果我将它添加到我的 web.config 中,我会收到“无法在 Web 服务器上开始调试”错误。我可以选择 Start without debugging 并且它工作正常。这是怎么回事?

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="401"/>
<error statusCode="401" responseMode="ExecuteURL" path="/Error401" />
</httpErrors>
</system.webServer>

最佳答案

httpErrors是仅由 IIS7 使用的新元素。这看起来有点奇怪,但是尝试在 system.web section 下的 web 配置中添加以下内容:

<customErrors mode="RemoteOnly"  defaultRedirect="~/error">
<error statusCode="401" redirect="~/Error401" />
</customErrors>

关于visual-studio-2010 - 向 system.webServer.httpErrors 添加 401 自定义错误会产生 "Unable to start debugging on the web server"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8270886/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com