开发者

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

开发者 https://www.devze.com 2023-03-12 04:25 出处:网络
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

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) ha开发者_高级运维s 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消