O. R. Mapper
O. R. Mapper

Reputation: 20731

Where do I set the maximum query string length?

From an HTTP request with a loooong query string - 2847 in this case -, I got back error 404.15 with the following message:

Überprüfen Sie die Einstellung "configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString" in der Datei "applicationhost.config" oder "web.config".

In English:

Check the "configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString" setting in the "applicationhost.config" or "web.config" file.

I did this, by following the documentation and changing the maximum query string length from 2048 to 4096 characters.

Evidently, the above change has had an effect, as the original error message is gone.

Instead, I am now getting another error, still related to the maximum query string length. This time, it comes with HTTP code 400 and says:

Die Länge der Abfragezeichenfolge für die Anforderung überschreitet den konfigurierten maxQueryStringLength-Wert.

In English:

The query string length of the request exceeds the configured maxQueryStringLength value.

Now, I have scanned all *.config files on my entire disks for any occurrences of the substring maxQueryString. There is only one such occurrence in total, and it is the Web.config file for my IIS default website, which says

<requestLimits maxQueryString="4096" />

Hence, something else must be influencing the maximum query length - where else can this setting me configured?

Upvotes: 0

Views: 13604

Answers (1)

Jalpa Panchal
Jalpa Panchal

Reputation: 12749

first, make sure you enabled the anonymous authentication in iis:

set below code in web.config file:

<system.web>

   <httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" />
                                ……
</system.web>

<system.webServer>
    <security>
    <requestFiltering>
      <requestLimits maxUrl="10999" maxQueryString="2097151" />
    </requestFiltering>
  </security>
</system.webServer>

Note: set value a little bit higher than your requirement. above mentioned is just an example. set this value in the root folder config file. and restart iis after doing changes.

Upvotes: 3

Related Questions