Vladimir Makhaev
Vladimir Makhaev

Reputation: 1104

IIS 7 query string length

I`m using Asp Net Mvc 4 Web Api and I need to make request with querystring length > 2000 symbols

I`ve allready set maxQueryStringLength="10000" parameter in web.config. Everything works well on my developer machine On IIS it works only if querystring < 2000 symbols, but if querystring > 2000 symbols I get an error: 404 Not Found

Any considerations?

Upvotes: 4

Views: 12165

Answers (2)

vahdet
vahdet

Reputation: 6729

Late for the party but, here is the three points we have changed to get rid of it:

In web.config, add httpRuntime tag the attribute maxQueryStringLength:

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

Again in web.config, add requestLimits tag the attribute maxQueryString:

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

If still no cure, from the IIS config, in ISAPI Filters section, remove the UrlScan filter. This last one did the trick in my case. But, beware, it brings a security risk.

Upvotes: 5

BNL
BNL

Reputation: 7133

Have you also set the maxUrl length?

maxUrl Optional uint attribute.

Specifies maximum length of the URL, in bytes.

The default value is 4096.

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

Upvotes: 2

Related Questions