zoukankan      html  css  js  c++  java
  • wcf序列化大对象时报错:读取 XML 数据时,超出最大

    错误为:

    访问服务异常:格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出
    错: request。InnerException 消息是“反序列化对象 属于类型 Fast.Infrastructure.WCFService.DataTransferObject.BaseRequest 时出现错误。读取 XML 数据时,超出最大
    字符串内容长度配额 (8192)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增加此配额
     
    解决办法:
     
    修改wcf客户端的配置
    <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="NewBinding0" maxReceivedMessageSize="65536000">
              <readerQuotas maxStringContentLength="2147483647" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost:8732/FAST.WCFService.Endpoint/FastService/"
            binding="wsHttpBinding"
            bindingConfiguration="NewBinding0" contract="Fast.Infrastructure.WCFService.Endpoint.IFastWCFService"
            name="fastEndpoint" />
        </client>
      </system.serviceModel>
     
    增加此binding 并设置readerQuotas 的maxStringContentLength的值 
    修改完后记得在endpoint 上加上此bingding:bindingConfiguration="NewBinding0"
  • 相关阅读:
    操盘策略:判断强庄股的四个诀窍
    三类股有望继续走强
    操盘策略:股市空头陷阱五大招数
    每日一招:面对亏损我们应该如何操作(鳄鱼法则)
    (转)一个大户的自白:我是这样被两融打爆的
    3.2、迭代
    3.1、切片
    2.4、递归函数
    2.3、函数的参数
    2.2、定义函数
  • 原文地址:https://www.cnblogs.com/gaogaolater/p/3558977.html
Copyright © 2011-2022 走看看