该请求被 IIS 拦截,并且它从未到达我的应用程序。
我希望我的错误处理程序来管理此错误,而不是 IIS。这可能吗?
我尝试了很多方法,包括:
在我的 Web.config 中:
<httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough"></httpErrors>
还有这个配置:
<httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough"> <remove statusCode="400"/> <error statusCode="400" path="http://www.google.com" responseMode="Redirect"/> </httpErrors>
- 来自 MSDN (IIS 7,IIS 8 文档中没有任何内容):
You cannot customize the following HTTP error messages: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.
在这里我们可以复制错误:
https://stackoverflow.com/ + %%%(您应该复制整个链接,包括无效字符)。
最佳答案
看来您对此不走运,因为以下线程已经显示:https://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url
一种可能的解决方案是在负载均衡器(当然不会基于 IIS)中处理此错误代码。
关于iis - 自定义错误 400(错误请求)避免 IIS-8 拦截它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29607822/