IIS 7 查询字符串长度

Vla*_*aev 4 iis asp.net-web-api

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

我已经在 web.config 中设置了 maxQueryStringLength="10000" 参数。在我的开发机器上一切正常 在 IIS 上,仅当查询字符串 < 2000 个符号时它才有效,但如果查询字符串 > 2000 个符号,我会收到错误: 404 Not Found

有什么注意事项吗?

vah*_*det 5

聚会迟到了,但是,为了摆脱它,我们改变了三点:

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

<system.web>
  <httpRuntime maxQueryStringLength="32768" />
</system.web>
Run Code Online (Sandbox Code Playgroud)

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

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxQueryString="32768" />
    </requestFiltering>
  </security>
<system.webServer>
Run Code Online (Sandbox Code Playgroud)

如果仍然无法解决,请从 IIS 配置ISAPI Filters部分中删除 UrlScan过滤器。最后一个在我的例子中发挥了作用。但是,请注意,它会带来安全风险。