maxItemsInObjectGraph ignored...
        Posted  
        
            by Palantir
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Palantir
        
        
        
        Published on 2010-02-24T10:46:32Z
        Indexed on 
            2010/05/20
            7:20 UTC
        
        
        Read the original article
        Hit count: 456
        
wcf
Hi! I have a problem with a WCF service, which tries to serialize too much data. From the trace I get an error which says that the maximum number of elements that can be serialized or unserialized is '65536', try to increment the MaxItemsInObjectGraph quota.
So I went and modified this value, but it is just ignored (the error is the same, with the same number). All this is server-side. I am calling the service via wget for the moment.
My web config is like this:
<system.serviceModel>  
  <behaviors>
   <serviceBehaviors>
    <behavior name="AlgoMap.Web.MapService.MapServiceBehavior">
       <dataContractSerializer maxItemsInObjectGraph="131072" />
       <serviceMetadata httpGetEnabled="true" />
       <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <bindings>
   <customBinding>
    <binding name="customBinding0" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:02:00">
      <binaryMessageEncoding>
        <readerQuotas maxDepth="64" maxStringContentLength="16384"
                                maxArrayLength="16384" maxBytesPerRead="16384"
                                maxNameTableCharCount="16384" />
      </binaryMessageEncoding>
      <httpTransport />
    </binding>
   </customBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  <services>
   <service behaviorConfiguration="AlgoMap.Web.MapService.MapServiceBehavior"
    name="AlgoMap.Web.MapService.MapService">
    <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
     contract="AlgoMap.Web.MapService.MapService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>
 </system.serviceModel>
Version 2, not working either:
 <system.serviceModel>  
  <behaviors>
    <endpointBehaviors>
      <behavior name="AlgoMap.Web.MapService.MapServiceEndpointBehavior">
         <dataContractSerializer maxItemsInObjectGraph="131072" />
      </behavior>
    </endpointBehaviors>
   <serviceBehaviors>
    <behavior name="AlgoMap.Web.MapService.MapServiceBehavior">
       <serviceMetadata httpGetEnabled="true" />
       <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <bindings>
   <customBinding>
    <binding name="customBinding0" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:02:00">
      <binaryMessageEncoding>
        <readerQuotas maxDepth="64" maxStringContentLength="16384"
                                maxArrayLength="16384" maxBytesPerRead="16384"
                                maxNameTableCharCount="16384" />
      </binaryMessageEncoding>
      <httpTransport />
    </binding>
   </customBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  <services>
   <service behaviorConfiguration="AlgoMap.Web.MapService.MapServiceBehavior"
    name="AlgoMap.Web.MapService.MapService">
     <endpoint 
        address="" binding="customBinding" bindingConfiguration="customBinding0"
        contract="AlgoMap.Web.MapService.MapService" 
        behaviorConfiguration="AlgoMap.Web.MapService.MapServiceEndpointBehavior" />
    <endpoint 
        address="mex" binding="mexHttpBinding" contract="IMetadataExchange"  
        behaviorConfiguration="AlgoMap.Web.MapService.MapServiceEndpointBehavior" />
   </service>
  </services>
 </system.serviceModel>
Can anyone help?? Thanks!!
© Stack Overflow or respective owner