Maximum number of items that can be serialized or deserialized

Topics: Web Api
May 19, 2011 at 5:05 PM

Returning a large amout of data as json and getting the following error, can anyone help?

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. "}

 

 

Coordinator
May 19, 2011 at 5:22 PM

Check this thread: http://wcf.codeplex.com/discussions/242523

May 19, 2011 at 5:50 PM

Glen,

Thanks for your response, but that does not mention the object graph quota are they the same thing?

Below is a snipet that was in the old config

<system.serviceModel>
 <behaviors>
  <endpointBehaviors>
   <behavior name="RESTFriendly">
    <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    <webHttp/>
   </behavior>
  </endpointBehaviors>
 </behaviors>
 <services>
  <service name="Stericycle.Services.CustomerService">
   <endpoint address="" behaviorConfiguration="RESTFriendly" binding="webHttpBinding" bindingConfiguration="wsHttpBindingSettings" contract="XXXXXXXX.Contracts.ICustomerService"/>
  </service>
 </services>
</system.serviceModel>

May 19, 2011 at 9:00 PM

 

Putting the attribute on the class definition seems to have solved my issue

    [ServiceContract]
    [ServiceBehavior(MaxItemsInObjectGraph = int.MaxValue)]
    public class MaintenanceResource