【发布时间】:2019-05-15 07:51:24
【问题描述】:
我在 Windows 2012 的 IIS 8.0 下创建了网站。在此站点下创建了一个使用 ARR 重写的 URL,它指向一台 linux 机器(基本上指向部署在 Tomcat 中的 Web 服务),并且通过 IIS 将有“GET”请求,其中URL 与查询字符串一起超过 5000 个字符。当通过程序或浏览器访问 URL 时,我看到 IIS 抛出“错误请求”,状态代码为 400,没有子状态代码。当它直接访问 web 服务(对于 tomcat Linux)时,同样有效。我怀疑这个问题是因为 url 中的字符过多,因为当我尝试将 url 长度减少到 3500 个字符时,它没有任何错误。以下是我在 IIS web.config 和 http.sys 注册表中尝试过的配置和设置,但似乎没有任何效果。
<configuration>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="4294967295" maxUrl="10999" maxQueryString="2097151">
<headerLimits>
<add header="Content-Type" sizeLimit="100000000" />
</headerLimits>
</requestLimits>
</requestFiltering>
</security>
<urlCompression doDynamicCompression="false" />
</system.webServer>
<system.web>
<httpRuntime maxRequestLength="8192" maxUrlLength="8192" maxQueryStringLength="8192" requestPathInvalidCharacters="" />
</system.web>
</configuration>
http.sys 注册表设置
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\MaxFieldLength - DWORD - 65534
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\MaxRequestBytes - DWORD - 16777216
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\UrlSegmentMaxCount - DWORD - 16383
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\UrlSegmentMaxLength - DWORD - 32766
在完成上述所有设置和配置后,我已经重新启动了 Windows 服务器。
IIS 支持这些设置和配置,无需重写 url。如果我为同一网站尝试其他长度为 5000 个字符的 url,它的工作原理没有任何错误。这仅出现在 URL 重写配置下的 url。除了上面提到的 ARR 中的 URL 长度是否需要进行任何特定的配置?请建议和帮助。 提前致谢。
【问题讨论】:
标签: windows iis iis-8 url-rewrite-module arr