WCF - Increase ReaderQuoatas on REST service

Posted by Christo Fur on Stack Overflow See other posts from Stack Overflow or by Christo Fur
Published on 2010-06-01T16:33:15Z Indexed on 2010/06/02 8:43 UTC
Read the original article Hit count: 640

Filed under:
|
|
|

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. http://stackoverflow.com/questions/65452/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?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about JSON