zoukankan      html  css  js  c++  java
  • WCF 客户端解决大数据量传输配置

    1. 服务端返回数据给客户端报错

      在客户端配置文件中,主要是配置maxReceivedMessageSize

    <system.serviceModel>
        <bindings>
          <basicHttpBinding>

    <binding name="ServiceProxyBinding" closeTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxStringContentLength="134217728" /> </binding>

    </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:8733/Test/Test.svc" binding="basicHttpBinding" bindingConfiguration="ServiceProxyBinding" contract="UniCloud.ServiceContracts.IPartService" name="IPartService" /> </client> </system.serviceModel>

    2. 客户端传数据给服务端报错

      修改服务端web.config,主要也是配置maxReceivedMessageSize

    <system.serviceModel>
    <bindings> <basicHttpBinding>
    <!--不写name,表示应用所有 basicHttpBinding-->
    <binding closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> </binding> </basicHttpBinding> </bindings>

    <behaviors> <serviceBehaviors> <behavior > <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 --> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>

    要修改所有的服务,不管是服务端还是客户端,Binding那边增加一个没有设置名字的默认配置就OK了

     参考文章:http://www.cnblogs.com/Gyoung/p/3369316.html

  • 相关阅读:
    莫队模板
    CF600E Lomsat gelral
    JZOJ 捕老鼠
    JZOJ 4896. 【NOIP2016提高A组集训第16场11.15】兔子
    JZOJ 4895【NOIP2016提高A组集训第16场11.15】三部曲
    双端队列xLIS问题
    最大K段和
    你真的了解ES6的promise吗?
    JS对象和数组深浅拷贝总结②
    当前页码删除唯一数据后加载前一页内容
  • 原文地址:https://www.cnblogs.com/gaobing/p/3816158.html
Copyright © 2011-2022 走看看