小编Riz*_*san的帖子

在WCF服务中传输大量数据

我在WCF中创建了一个Web服务,它返回超过54000个数据行,每行有10个数据.我使用wsHttpBinding进行通信.该服务适用于较少的数据(即2000行)但在尝试发送50000+行(~2MB)的大型记录集时会爆炸.异常消息是这样的

收到HTTP响应时发生错误http://localhost:9002/MyService.svc.这可能是由于服务端点绑定不使用HTTP协议.这也可能是由于服务器中止HTTP请求上下文(可能是由于服务关闭).请参阅服务器日志以获取更多详

请不要告诉我在客户端使用分页 - 我知道它会解决问题.但我需要客户端的整个数据块.

我在服务器上的服务配置是

<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="MyWsHttpBinding" />
    </wsHttpBinding>
  </bindings>
  <services>
    <service name="AdminService">
      <endpoint address="AdminSrv"
                binding="wsHttpBinding"
                contract="IAdminService"/>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="/Bus/IRfotoWCF" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <!-- To avoid disclosing metadata information, 
                  set the value below to false and remove the metadata endpoint above before deployment -->
        <serviceMetadata httpGetEnabled="True"/>
        <!-- To receive exception details in faults for debugging purposes, 
                  set the value below to …
Run Code Online (Sandbox Code Playgroud)

wcf wcf-binding wcf-data-services

20
推荐指数
1
解决办法
6万
查看次数

标签 统计

wcf ×1

wcf-binding ×1

wcf-data-services ×1