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

Si nos aparece este error especificado en el título podemos solucionarlo aumentando el valor de MaxItemsInObjectGraph del siguiente modo:
Error

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.

Solution: Edit app.config

<configuration>
   [...]
   <system.serviceModel>
      [...]
      <client>
         <endpoint address="URL"
                   [...] 
                   name="myName                   behaviorConfiguration="customQuotaBehavior" />
      </client>
      <behaviors>
         <endpointBehaviors>
            <behavior name="myName">
               <dataContractSerializer maxItemsInObjectGraph="409600"/>
            </behavior>
         </endpointBehaviors>
      </behaviors>
   </system.serviceModel>
</configuration>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.