简体   繁体   中英

Wcf ignore MaxItemsInObjectGraph value

Our WCF service has the following exception:

Maximum number of items that can be serialized or deserialized in an object graph is '32767'. Change the object graph or increase the MaxItemsInObjectGraph quota.

We change the config to:

  <behavior name="large">
      <dataContractSerializer maxItemsInObjectGraph="214783647"/>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
  </behavior>

But no change.

In debug mode when the service host is open the value of the DataContractSerializer is 214783647 and the exception is still occur.

Changing the value programmaticly doesn't help.

Add an attribute of ServiceBehavior on the service doesn't help.

Change the machine.config like here - doesn't help.

Any ideas? Thanks.

You may want to confirm that the error is not coming from the other side (client) of the transaction.

One way to verify, is to configure and enable WCF diagnostic event tracing and message logging, then rerun the test transaction and review the service trace log file. The following link demonstrates how to enable tracing and message logging.

http://msdn.microsoft.com/en-us/library/ms751526.aspx

Thanks to my college the problem solved with removing ReferencePreservingDataContractFormat attribute, we think it's because this attribute create it's own DataContractSerializer that ignore the configuration.

More details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM