今天终于测试解决了WCF传递大数据量的问题

Web.config上的配置:

 <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="MyDataService_Behavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                    <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_MyDataService"
                      receiveTimeout="00:10:00"
                      sendTimeout="00:10:00"
                      openTimeout="00:10:00"
                      closeTimeout="00:10:00"
                      maxReceivedMessageSize="2147483647"
                      maxBufferSize="2147483647"
                     maxBufferPoolSize="2147483647" >
              <readerQuotas
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxDepth="2147483647"
                 maxNameTableCharCount="2147483647"
                 maxStringContentLength="2147483647" />
              <security mode="None"/>
            </binding>
          </basicHttpBinding>
        </bindings>
   
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />
   
        <services>
            <service name="MyWebSer.MyDataService" behaviorConfiguration="MyDataService_Behavior">
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyDataService"
                    contract="MyWebSer.MyDataService" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>
    </system.serviceModel>

ServiceReferences.ClientConfig的配置:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_MyDataService" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:1816/MyDataService.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_MyDataService" contract="MySerRef.MyDataService"
        name="BasicHttpBinding_MyDataService" />
    </client>
  </system.serviceModel>

测试时查询了50000条记录,每条记录有不少于40个字段。

转载于:https://www.cnblogs.com/futureflare/archive/2011/06/30/2094215.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值