Huge amounts of data WCF \ Silverlight

18. March 2011 04:03 by Mrojas in General  //  Tags: , , , , , , ,   //   Comments (0)

 

Today I found this excellent post:
http://smehrozalam.wordpress.com/2009/01/29/retrieving-huge-amount-of-data-from-wcf-service-in-silverlight-application/ 
and I was the key to solve a problem I had with a WCF service.

I had made some changes to an application to send a text file to the server
for batch processing, everything was working fine until I started sending big files.

I just received one of those obnoxious Not Found error.
So what could I do? Well as any respectable WCF developer would I started tracing the WCF messages with Fiddler, and I found this:

If you cannot read it from the image the message was:

DeserializationFailed… The formatter threw an exception while trying to deserialize the message:
There was an error while trying to deserialize parameter :_xxxxxx.
The InnerException message was 'There was an error deserializing the object of type System.String.
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.

I was a little confused but thanks to that post I was able to just add:

          <binaryMessageEncoding maxWritePoolSize="16" maxSessionSize="8192">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                                   maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binaryMessageEncoding>
 
 

And got everything working again!