IIS 8 - 自定义400错误(错误请求) [英] IIS 8 - customize error 400 (Bad Request)

查看:1371
本文介绍了IIS 8 - 自定义400错误(错误请求)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该请求被截获的IIS,它从不打我的申请。

我想,我的错误处理来管理这个错误,而不是IIS。这可能吗?

我试过很多东西,其中包括:


  1. 在我的web.config:< httpErrors errorMode =DetailedLocalOnlyexistingResponse =直通>< / httpErrors>


  2. 没有任何帮助


  3. 另外这款配置:



 < httpErrors errorMode =DetailedLocalOnlyexistingResponse =直通>
    <清除状态code =400/>
    <错误状态code =400路径=htt​​p://www.google.comresponseMode =重定向/>
< / httpErrors>


<醇开始=4>

  • MSDN ( IIS 7,没事就IIS 8文档):


  •   

    您不能自定义以下HTTP错误信息:400,403.9,
      411,414,500,500.11,500.14,500.15,501,503,和505。


    在这里我们可以复制错误:

    http://stackoverflow.com/ %%%(你应该复制整个环节,与无效字符在内)。


    解决方案

    看来你的运气了以此为以下线程已经显示:<一href=\"http://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url\">http://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url

    一个可行的办法是在负载平衡器来处理这个错误code(这当然不会是IIS为基础)。

    The request is intercepted by the IIS, and it never hits my application.

    I want that my Error Handling to manage this error, not IIS. Is this possible?

    I've tried many things, including these:

    1. In my Web.config: <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough"></httpErrors>

    2. This is not helping either.

    3. Also this configuration:

    <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough">
        <remove statusCode="400"/>
        <error statusCode="400" path="http://www.google.com" responseMode="Redirect"/>
    </httpErrors>
    

    1. From the MSDN (IIS 7, nothing on IIS 8 documentation):

    You cannot customize the following HTTP error messages: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

    Here we can replicate the error:

    http://stackoverflow.com/ %%% (you should copy the entire link, with the invalid characters included).

    解决方案

    It seems that you are out of luck with this as the following thread already shows: http://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url

    One possible solution is to handle this error code at your load balancer (which of course will not be IIS based).

    这篇关于IIS 8 - 自定义400错误(错误请求)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆