I need to pass a Dictionary (with max 20,000 entries) to a WCF service. Can I pass it all by once?
void SubmitDictionary(Dictionary<string, MyEntry> val);
where MyEntry is :
class MyEntry
{
string Name;
long Age;
}
Is there a configuration for size of the value passed? Or can we pass as large data as this?
Two things I need to know.
What type of binding ru using ? Like BasicHttpBinding
or wsHttpBinding
. If you are using wsHttpBinding
you don't need to worry about it's length
Have you made your class serializeable? If not then make it like this:
[DataContract]
public Class MyEntry
{
[DataMember]
public string Name {get; set;}
[DataMember]
public long Age {get; set;}
}
You unfortunately have a bigger problem and that's that you can't serialize an IDictionary.
You're probably going to have to create an array or similar of a serializable custom key-value type.
There's MaxReceivedMessageSize , MaxStringContentLength and MaxBufferSize .
Check the link
Read related question on how to increase size
Silverlight & WCF: Max message size
EDIT Check also Service Reference's configuration. You should set Dictionary collection type to Dictionary
.
Good Luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.