For the last two or three days, I've been trying without success to add a WCF callback to our storage web service. I'm going to need to give up for this sprint, but this is a feature that I'm sure we will need and want in the future.
Our current web service uses BasicHttpBinding. I realized fairly quickly that this doesn't support WCF callbacks, so I've been trying to convert it to use PollingDuplexHttpBinding. I was able to get the service's Web.config configured to use this, but could
never get the ServiceReferences.ClientConfig file to accept it. Based on various things that I read online, I concluded that I might need to create the binding in code. I did that and was able to have some communication with the service.
The problem is that I am unable to save data because it is hitting a string size limit. The exception says that I need to increase MaxStringContentLength for the XMLDictionaryReaderQuotas. I was never able to figure out how to do that for a PollingDuplexHttpBinding.
For the BasicHttpBinding it is easy, but I can't seem to find any way to do it for the polling binding.
The problem I have with this is that I get exceptions saying that binaryMessageEncoding has no child elements or attributes. Anything I do like this throws an exception even earlier. I'm using Silverlight 4.0 and .Net 4.0 (for the web service). It seems
I've tried everything, but enough people seem to be doing this that there must be something obvious that I've missed. I don't want to clutter this initial message with unnecessary information, but I can provide any required details tomorrow when I am back
at work.
As described in this Web Service Team
blog, there are some known issues of WCF Silverlight 4.
One of them is similar as yours you can try as following.
Problem: When using Web.config on the service to instantiate <pollingDuplexHttpBinding>, any nested <readerQuotas> element is not respected.
Workaround: Instead of using <pollingDuplexHttpBinding>, use a <customBinding> containing a <pollingDuplex> element. Then instead of setting the values on <readerQuotas>, set the same values on the <textMessageEncoding> or <binaryMessageEncoding>
element.
jswartzen
Member
2 Points
2 Posts
Unable to use WCF Callback
Jan 25, 2011 11:23 PM | LINK
For the last two or three days, I've been trying without success to add a WCF callback to our storage web service. I'm going to need to give up for this sprint, but this is a feature that I'm sure we will need and want in the future.
Our current web service uses BasicHttpBinding. I realized fairly quickly that this doesn't support WCF callbacks, so I've been trying to convert it to use PollingDuplexHttpBinding. I was able to get the service's Web.config configured to use this, but could never get the ServiceReferences.ClientConfig file to accept it. Based on various things that I read online, I concluded that I might need to create the binding in code. I did that and was able to have some communication with the service.
The problem is that I am unable to save data because it is hitting a string size limit. The exception says that I need to increase MaxStringContentLength for the XMLDictionaryReaderQuotas. I was never able to figure out how to do that for a PollingDuplexHttpBinding. For the BasicHttpBinding it is easy, but I can't seem to find any way to do it for the polling binding.
There are solutions that suggest things like:
<customBinding>
<binding name="binaryHttpBinding">
<binaryMessageEncoding maxReadPoolSize="2147483647" maxSessionSize="2147483647" maxWritePoolSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="5242880"
maxArrayLength="200000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
</binding>
</customBinding>
The problem I have with this is that I get exceptions saying that binaryMessageEncoding has no child elements or attributes. Anything I do like this throws an exception even earlier. I'm using Silverlight 4.0 and .Net 4.0 (for the web service). It seems I've tried everything, but enough people seem to be doing this that there must be something obvious that I've missed. I don't want to clutter this initial message with unnecessary information, but I can provide any required details tomorrow when I am back at work.
alt_fo
Contributor
6414 Points
1313 Posts
Re: Unable to use WCF Callback
Jan 26, 2011 03:56 AM | LINK
Can you have a look at my blog below, i have explained with sample source and the filewatcher sample
http://altfo.wordpress.com/2010/08/15/wcf-callback-function-filesystemwatcher/
Senthamil.
Please Mark Answered, If my solution solves your problem.
Shi Ding - MSFT
All-Star
24707 Points
3151 Posts
Microsoft
Re: Unable to use WCF Callback
Feb 01, 2011 08:07 AM | LINK
Hi,
As described in this Web Service Team blog, there are some known issues of WCF Silverlight 4.
One of them is similar as yours you can try as following.
Problem: When using Web.config on the service to instantiate <pollingDuplexHttpBinding>, any nested <readerQuotas> element is not respected. Workaround: Instead of using <pollingDuplexHttpBinding>, use a <customBinding> containing a <pollingDuplex> element. Then instead of setting the values on <readerQuotas>, set the same values on the <textMessageEncoding> or <binaryMessageEncoding> element.
Hope this helps
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework