Monday, December 31, 2012

Communication WCF and silverlight5 with big object

Communication WCF and silverlight5 with big object

I'm new to WCF and Silverlight, there is an application with Silverlight client and WCF server, It had been working fine until I added a method which takes a big object as parameter. This object contains 93 properties of type int, bool, string, enum. When it blocks, WCF give error message like this:

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

No other message meaningful. All the Timeout and Buffersize in the config file are already set to the maximum value.

I have tried with an other object which contains less properties... I added one by one and it worked.

I found out when there are 72 properties(with enum, bool, string, int) it works, but when I add one more, it doesn't work any more.

I have been struggling during one week until right now, thanks a lot for helping me...

Answers & Comments...

Answer: 1

Try setting all the server-side quotas to the maximum, e.g. something like this:

<bindings>   <basicHttpBinding>     <binding name="MyBasicHttpBinding"          maxReceivedMessageSize="2147483647"         >       <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />       </binding>    </basicHttpBinding> </bindings>   <services>   <service name="MyWcfService">     <endpoint address="http://myservice..."       binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"       name="MyBasicHttpBinding" contract="IMyContract" />   </service> </services>  
by : Eugene Osovetskyhttp://stackoverflow.com/users/182155

Answer: 2

In the end we found the solution, for those who have the same problem: it was because that ny defaut, the MaxSessionSize(int the BinaryMessageEncodingBindingElement) of NetTcpBinding is maximun 2048, and we can not add any more, so we have to change into custombing with bigger MaxSessionSize.....

by : Liu Yufanghttp://stackoverflow.com/users/1919410




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog