views:

764

answers:

4

Hi,
my WCF service it's used by a Silverlight application to retrieve data. I've no problem,

    [OperationContract]
MyCollectionClass GetList(int sessID, string name);

  [CollectionDataContract]
public class MyCollectionClass : List<MyClass>{ }

  [DataContract]
public class MyClass {

  [DataMember]
  public string Prop1 { get; set; }

  [DataMember]
  public string Prop2 { get; set; }

}

But.. when MyCollectionClass have a less then 3000+ "record" it works. When the number of records is greater the WCF service seems to work, but on the completed event of the Silverlight app an exception occurs: "Service Not Found".
I've found that could be related to service configuration and i've tryied to use both:

maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"

on WCF and Client configuration. Also added:

readerQuotas: 
  maxArrayLength="2000000" 
  maxStringContentLength="2000000"/>

(also changed the values found) But seems to not working. I think that the problem is that the message exceed the max number of byte per "message", but I do not understand why data is not spanned on different message.
Any tips is appreciated.

Giorgio

A: 

Try to enable wcf service logging on server side. This might help: http://msdn.microsoft.com/en-us/library/ms730064.aspx

Nikolay R
+1  A: 

I had the same problem, in my case was just serializing an string and no prob there, BUT in your case you are serializing a big bunch of objects, there's a default limit for that, I remember I saw a post about that (just a setting in the config --> maxItemsInObjectGraph) to high up that number of serialized objects,

Links

http://silverlight.net/forums/t/17674.aspx http://forums.asp.net/t/1330713.aspx

Settings:

HTH Braulio

Braulio
the section that made the trick is :<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />I have only managed the first 2 before. Now it works :D. Thanks
krumikaze
A: 

I use these 2 statement right after InitializeComponent:

binding.MaxReceivedMessageSize = 5000000 binding.MaxBufferSize = 5000000

You can change the numbers to what you want but I had to do this in order to recieve a large amount of data on the Silverlgiht client. My binding object is defines as:

Private binding As New BasicHttpBinding

This is in vb.net. Works like a charm after I include these items.

Bill