Is it possible to increase the Maximum String Content Length property of a Polling Duplex binding without converting to Custom binding?

StackOverflow https://stackoverflow.com/questions/6306034

Question

I am using Polling Duplex Binding for the communication between my Silverlight client application and my WCF web service. I push messages from the Silverlight web applciation to the WCF web service by calling asynchronously a method from the web service with an xml string parameter. Everything worked fine until I tried to send a really big xml string. Then I get the message:

"The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'SendUserSelection'. 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."

What is usually done in this case is increase the maxStringContentLength property for the binding in the web.config file. The problem here is that when trying to add the readerQuotas element (containing the maxStringContentLength) to the binding, it is not taken into consideration at all. I found that it is a known problem: http://blogs.msdn.com/b/silverlightws/archive/2010/04/04/some-known-wcf-issues-in-silverlight-4.aspx . The solution given there is to use a Custom Binding containing a Polling Duplex element. I tried that but somehow I didn't get it working.

My question is there some other workaround for this issue or is this the only solution?

Was it helpful?

Solution

No, you really need to go to a custom binding. The PollingDuplexHttpBinding class does not expose the reader quotas, so if you have a quotas issue, you really need to go to the custom binding route.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top