wcfjsonrestreaderquotas

WCF - Increase ReaderQuoatas on REST service


I have a WCF REST Service which accepts a JSON string

One of the parameters is a large string of numbers

This causes the following error - which is visible by tracing and using SVC Trace Viewer

There was an error deserializing the object of type CarConfiguration. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.

Now I've read all sorts of articles advising how to rectify this

All of them recommend increasing various config settings on the server and client

e.g. Error Serializing String in WebService call

http://bloggingabout.net/blogs/ramon/archive/2008/08/20/wcf-and-large-messages.aspx

http://social.msdn.microsoft.com/Forums/en/wcf/thread/f570823a-8581-45ba-8b0b-ab0c7d7fcae1

So my config file looks like this

 <webHttpBinding>
        <binding name="webBinding" maxBufferSize="5242880"  maxReceivedMessageSize="5242880" >
          <readerQuotas  maxDepth="5242880" maxStringContentLength="5242880" maxArrayLength="5242880" maxBytesPerRead="5242880" maxNameTableCharCount="5242880"/>
        </binding>
   </webHttpBinding>
...
...
...
<endpoint 
      address="/"
      binding="webHttpBinding"
      bindingConfiguration="webBinding"

My problem is that I can change this on the server, but there are no WCF config settings on the client as its a REST service and I'm just making a http request using the WebClient object

any ideas?


Solution

  • so it turns out you need a fullly qualified url on the endpoint address, not a relative one

    Error calling a WCF REST service using JSON. length quota (8192) exceeded