IIS 7查询字符串长度

时间:2012-07-30 17:06:59

标签: iis asp.net-web-api

我正在使用Asp Net Mvc 4 Web Api,我需要使用查询字符串长度>进行请求。 2000个符号

我已经在web.config中设置了maxQueryStringLength =“10000”参数。 一切都在我的开发者机器上运行良好 在IIS上,它仅在querystring< 2000个符号, 但如果查询字符串> 2000个符号我收到错误:404 Not Found

有何考虑?

2 个答案:

答案 0 :(得分:1)

您是否也设置了maxUrl长度?

  

maxUrl可选的uint属性。

     

指定URL的最大长度(以字节为单位)。

     

默认值为4096。

http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits

答案 1 :(得分:1)

派对迟到了,但是,我们已经改变了三点来摆脱它:

web.config中,添加httpRuntime标记属性maxQueryStringLength

<system.web>
  <httpRuntime maxQueryStringLength="32768" />
</system.web>

再次在web.config中,添加requestLimits标记属性maxQueryString

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxQueryString="32768" />
    </requestFiltering>
  </security>
<system.webServer>

如果仍无法解决问题,请从ISAPI Filters部分的IIS配置中删除UrlScan过滤器。最后一个在我的情况下做了伎俩。但是,请注意,它会带来安全风险。

相关问题