WCF says it exceeds the maximum query string value until it

I have a WCF service (more webHttpBinding) using ASP.NET 4 / IIS 8, and I had no problems communicating with it using JSON with GET. However, today I needed to implement a method that sends a large query string (about 3000 characters, but not so long, but longer than I used). I called the service and immediately got a 404 error, without even fitting into my code on my debug machine. The first thing that occurred to me was the maximum limit on the length of the query string. I added this to my web.config:

 <system.webServer>
    <directoryBrowse enabled="true" />
    <security>
      <requestFiltering>
        <requestLimits maxQueryString="8000"></requestLimits>
      </requestFiltering>
    </security>
  </system.webServer>

Now I get this server error when I call the service: The length of the query string for this request exceeds the configured maxQueryStringLength value.Quite strange, I tried other values, such as 200000by my query string and URL, which is about 3000 characters. Did I miss something?

+3
source share
1 answer

Perhaps set maxQueryStringLengthto the httpRuntime element .

It is a little confusing to have two configuration parameters, but I think that they can be interpreted as follows:

  • The httpRuntimemaxQueryStringLength property is new to ASP.NET 4 and sets the maximum length of the query string that can be processed using the ASP.NET HTTP runtime. Prior to ASP.NET 4, this was a tough 2048 value; Now it can be increased.

  • system.web/security/requestFiltering maxQueryStringLength - IIS 7 . ASP.NET.

+4

All Articles