Passing a Dictionary to a WCF Service

I need to pass the dictionary (maximum 20,000 entries) to the WCF service. Can I transfer everything in one go?

void SubmitDictionary(Dictionary<string, MyEntry> val); 

where is myentry:

 class MyEntry { string Name; long Age; } 

Is there any configuration for the size of the passed value? Or can we transfer big data like this?

+6
dictionary c # wcf
source share
3 answers

Two things I need to know.

  • What type of binding is used? Like BasicHttpBinding or wsHttpBinding . If you use wsHttpBinding , you do not need to worry about this length

  • Have you made your serializable class? If not, do this:

  [DataContract] public Class MyEntry { [DataMember] public string Name {get; set;} [DataMember] public long Age {get; set;} } 
+4
source share

You, unfortunately, have a big problem, and that you cannot serialize IDictionary.

You will probably have to create an array or a similar serializable type of custom key.

+4
source share

There MaxReceivedMessageSize , MaxStringContentLength and MaxBufferSize .

Check link

http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx

Read the related question on how to increase size

Maximum wcf message size

Silverlight and WCF: Maximum Message Size

EDIT Check also the help desk configuration. You must set the dictionary collection type to Dictionary .

Good luck

+3
source share

All Articles