【发布时间】:2015-10-16 00:53:24
【问题描述】:
我总是遇到错误。
错误请求 - 无效的 URL。 HTTP 错误 400。请求 URL 无效。
/Search/ 之后的所有内容都是我通过路由处理的查询字符串。
routes.MapRoute(
"Search", // Route name
"Search/{*q}", // URL with parameters
new { controller = "Search", action = "Index", q = UrlParameter.Optional } // Parameter defaults
);
在上面的 URL 中,我猜它超过了最大查询字符串参数长度,所以我尝试像下面这样增加它。
<system.web>
<!--<httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>-->
<httpRuntime targetFramework="4.5" maxUrlLength="2097151" relaxedUrlToFileSystemMapping="true" maxQueryStringLength="2097151" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="40960" maxQueryString="2097151" />
</requestFiltering>
</security>
</system.webServer>
我试过了 request exceeds the configured maxQueryStringLength when using [Authorize]
How to configure the web.config to allow requests of any length
【问题讨论】:
标签: asp.net asp.net-mvc url iis windows-server-2008-r2