In a WCF 4.0 service we receive a huge amount of data in a generic list. This list object graph is bigger than the 65536 default limit. We are quite used to it, so we have configured the service for being able to getting those big graphs.
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
With the above chunk of xml config we have avoided the problem in the past with no problem, but now it doesn't work. The only difference is that here we are using KnownTypes in the huge list elements that we are trying to deserialize in the WCF method.
Maybe, am I missing some special configuration for knowntypes?
Don't forget to check client configuration.
See similar answers in How to fix MaxItemsInObjectGraph error?
You need to set the MaxItemsInObjectGraph on the dataContractSerializer using a behavior on both the client and service.
and maxItemsInObjectGraph ignored
I had forgot to place this setting in my client app.config file
.
With reference to http://wcf.codeplex.com/discussions/258278, put the following ServiceBehavior attribute on the class definition as follows:
[ServiceContract]
[ServiceBehavior(MaxItemsInObjectGraph = int.MaxValue)]
public class MaintenanceResource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With