Maximum number of items that can be serialized or deserialized in an object grap
清泛原创
报错消息:
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.
修改如下相应的WCF配置,即可解决。
服务器端:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
...
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" ...>
...
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
客户端:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
...
</bindings>
<client>
<endpoint ... behaviorConfiguration="ServiceBehavior" />
</client>
</system.serviceModel>
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.
修改如下相应的WCF配置,即可解决。
服务器端:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
...
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" ...>
...
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
客户端:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
...
</bindings>
<client>
<endpoint ... behaviorConfiguration="ServiceBehavior" />
</client>
</system.serviceModel>
上一篇:WCF简单配置
下一篇:WCF 接口List类型变成了Array型的原因