Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.
To fix the error the MaxItemsInObjectGraph must be defined on the wcf service server and the client.
On the server:
<system.serviceModel> <services> <service behaviorConfiguration="Service1Behavior" name="Service1"> <endpoint address="" binding="basicHttpBinding" contract="IService1"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="Service1Behavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
On the client:
<system.serviceModel> <client> <endpoint address="http://localhost/Service1.svc" behaviorConfiguration="Service1Behavior" binding="basicHttpBinding" contract="IService1Event" name="Service1"> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="Service1Behavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel>
2 comments:
The below post will extend this explanation a bit wide.
http://vangalvenkat.blogspot.in/2012/11/change-object-graph-or-increase.html
Thanks
Venkat
Thanks, this was very helpful!
Post a Comment