清泛IT社区

标题: Maximum number of items that can be serialized or deserialized in an object grap [打印本页]

作者: 清泛网    时间: 2015-04-22 16:40
标题: 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.
报错消息:
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>





欢迎光临 清泛IT社区 (https://bbs.tsingfun.com/) Powered by Discuz! X3.3