zoukankan      html  css  js  c++  java
  • WCF:Maximum number of items that can be serialized or deserialized in an object graph is '65536'.

    错误

    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. 

    解决

    服务器端:

    ServiceHost host = new ServiceHost(serviceType, uri);
    foreach (IServiceBehavior behavior in host.Description.Behaviors)
    {
    if (behavior is ServiceBehaviorAttribute)
    {
    (behavior as ServiceBehaviorAttribute).MaxItemsInObjectGraph = int.MaxValue;
    }
    }

     

    客户端:

    ChannelFactory<T> channelFactory = new ChannelFactory<T>(binding);
    foreach (OperationDescription op in channelFactory.Endpoint.Contract.Operations)
    {
    DataContractSerializerOperationBehavior dataContractBehavior = op.Behaviors.Find<DataContractSerializerOperationBehavior>() as DataContractSerializerOperationBehavior;
    if (dataContractBehavior != null)
    {
    dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
    }
    }

     

  • 相关阅读:
    underscore.js,jquery.js源码阅读
    css3动画知识点
    ajax防止重复提交
    jquery data属性的使用
    文字换行
    vue的生命周期
    iphone与安卓的兼容性问题汇总
    python 上下文管理器
    form 校验
    常用的字段和字段参数
  • 原文地址:https://www.cnblogs.com/ego/p/2471231.html
Copyright © 2011-2022 走看看