简体   繁体   English

Wcf忽略MaxItemsInObjectGraph值

[英]Wcf ignore MaxItemsInObjectGraph value

Our WCF service has the following exception: 我们的WCF服务有以下例外:

Maximum number of items that can be serialized or deserialized in an object graph is '32767'. 在对象图中可以序列化或反序列化的最大项数是'32767'。 Change the object graph or increase the MaxItemsInObjectGraph quota. 更改对象图或增加MaxItemsInObjectGraph配额。

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. 在调试模式下,当服务主机打开时,DataContractSerializer的值为214783647,并且仍然会发生异常。

Changing the value programmaticly doesn't help. 以程序方式改变价值并没有帮助。

Add an attribute of ServiceBehavior on the service doesn't help. 在服务上添加ServiceBehavior的属性没有帮助。

Change the machine.config like here - doesn't help. 这里更改machine.config - 没有帮助。

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. 验证的一种方法是配置和启用WCF诊断事件跟踪和消息记录,然后重新运行测试事务并查看服务跟踪日志文件。 The following link demonstrates how to enable tracing and message logging. 以下链接演示了如何启用跟踪和消息日志记录。

http://msdn.microsoft.com/en-us/library/ms751526.aspx 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. 感谢我的大学,通过删除ReferencePreservingDataContractFormat属性解决了问题,我们认为这是因为该属性创建了自己的DataContractSerializer,忽略了配置。

More details 更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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