I am calling my WCF Web service using jQuery $.ajax json POST.
One of the input parameters is very long - over 8000 bytes. The data in it is a comma-separated list of GUIDs, like this "78dace54-1eea-4b31-8a43-dcd01e172d14,ce485e64-e7c6-481c-a424-2624371180aa,ede4c606-f743-4e0a-a8cc-59bcffa7feda,f0a81ed1-80db-4f6d-92d7-2fc47759a409".
When that parameter is 8176 bytes long, the request succeeds. When it's 8213 (one more comma and GUID) - the request fails.
It fails from the browser and from Fiddler (HTTP debugging proxy).
I added this to the webservice config:
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000" recursionLimit="50000"/>
</webServices>
</scripting>
</system.web.extensions>
That does not make any difference, the request still fails for input param over 8176 bytes long.
That input param maps into a String on the WCF side.
What am I missing? Thank you!
UPDATE, this solved my problem: Turns out that this setting controls the total JSON message length
<webServices>
<jsonSerialization maxJsonLength="50000000" recursionLimit="50000"/>
</webServices>
There is another setting that controls maximum length for individual parameters:
<bindings>
<webHttpBinding>
<binding name="Binding_Name" maxReceivedMessageSize="900000">
<readerQuotas maxDepth="32" maxStringContentLength="900000" maxBytesPerRead="900000" maxArrayLength="120000" maxNameTableCharCount="120000"/>
</binding>
</webHttpBinding>
</bindings>
Also, make sure to set this:
<system.web>
<httpRuntime maxRequestLength="900000"/>
Hope this takes care of some headaches out there!