web-config之AppHarbor之为什么我的 httpRuntime maxRequestQueryStringLength ="XXXX"/> 不工作
我有一个很长的查询字符串值需要传入(我理解这本身就是一个有问题的做法),但我无法让它在我的 Appharbor 上生效。应用实例。
在本地,我对我的 web.config 进行了此更改并确认有问题的 URL 在本地有效:
<httpRuntime maxQueryStringLength="2097151"/>
并确保它存在于由我的 Web.Release.config 转换后的结果 web.config 中。就是说,当我推送到 AppHarbor 时,转换应该会恢复...但我仍然收到此异常:
The length of the query string for this request exceeds the configured maxQueryStringLength value.
堆栈跟踪:
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
有什么想法吗?感谢您的帮助。
请您参考如下方法:
我最初的测试是针对 Cassini(VS 2010 的内置网络服务器)完成的。我在本地推送到 IIS 7.5 并发现此错误:
HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.
出现是因为我没有在 <system.webServer> 中指定 maxQueryLength我的 web.config 部分以及 <httpRuntime> .所以答案是同时指定 <system.web>和 <system.webServer>部分:
<system.web>
<httpRuntime maxQueryStringLength="2097151"/>
</system.web>
然后:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="2097151"/>
</requestFiltering>
</security>
</system.webServer>
当我将这个版本的配置推送到 AppHarbor 时,一切都很好。希望这会有所帮助。
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。



