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>

WCF Maximum number

分享到:
评论加载中,请稍后...
创APP如搭积木 - 创意无限,梦想即时!
回到顶部