1

I'm getting the exception:

"Maximum number of items that can be serialized or deserialized in an object graph is '65536'"

on two (Staging, and Production) out of three servers, and I can't think why there is an issue.

Since it works on the Test server [IIS7.5 w2k8r2] I feel I can rule out the website's web.config.

I've gathered up the machine.config, and the webservers's web.configs, and compared them, and I can't see any issue.

Could there be configuration settings from some where else?

Edit:

This is the relevant part of the config file:

</system.webServer>
<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="TheEndPointBehaviour">
      <dataContractSerializer maxItemsInObjectGraph="6553600" />
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="TheEndPoint" maxReceivedMessageSize="6553600" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://ipaddress/folder/service.svc"
    binding="basicHttpBinding" bindingConfiguration="TheEndPoint"
    contract="Reference.IService" name="TheEndPoint" />
</client>

The developer used 6553600, however I have upped this to 2147483647 and that does not work.

1
  • 1
    This usually is a web.config setting. Please post the relevant parts of the config (bindings)
    – MichelZ
    Apr 24, 2014 at 13:02

1 Answer 1

1

Are the operations that you're testing exactly the same across all three servers? If you're working with different data sets then that could explain why you're not seeing it on all servers.

This is often a result from the client not being able to serialize / deserialize enough. You can increase the threshold by adding an endpoint behavior (or on a custom behavior if you use them in your project):

  <endpointBehaviors>
    <behavior name="blah">
      <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    </behavior>
  </endpointBehaviors>

You may need to do this both in your web.config and your client's app.config.

5
  • Yes the same service on the same machine is being used for all three servers. The developer had used maxItemsInObjectGraph="6553600" which does work on the Test server, but I have replaced this with "2147483646" on Staging but this does not work.
    – zeristor
    Apr 24, 2014 at 13:37
  • @zeristor Not the same service, the same data sets on that service. What is the client app? If it's a WCF client does it also have the endpoint behavior set?
    – squillman
    Apr 24, 2014 at 13:42
  • They the same version of the same website, pointing at the same service, using the same datasets (good point thanks). The only differences are the servers they are on, and the db connections they are using.
    – zeristor
    Apr 24, 2014 at 13:45
  • 1
    I know it sounds like I'm beating a dead horse, but can you verify that you're getting the exact same data from the operations? It sure feels like you're getting more data back on the two that are failing.
    – squillman
    Apr 24, 2014 at 13:48
  • That is a good point. I'm sure we are, but I'll validate that assumption.
    – zeristor
    Apr 24, 2014 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .