本文介绍了带流的WCF块数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,
我没有必要将大块数据从WCF服务传递到客户端。我有一个包含1600万条记录的表,因此,当客户端从该表请求数据时,我打开该表的数据读取器,然后序列化并将每条记录发送给客户端,这是我的方法签名。.

I neet to pass chunk data from WCF service to client. I have a table with 16 million records, and so, when the client requests data from that table i open a datareader to that table and serialize and send every record to client,here is my method signature..

public AsyncResult FindAsync(AsyncRequest request)

其中AsyncResult和AsyncRequest是MessageContract,而AsyncResult中具有流。问题是,当客户端调用方法时,直到所有数据未写入服务器中的流中时,我的函数才返回...是否可以更改此行为或我必须使用回调?

where AsyncResult and AsyncRequest are MessageContract, and AsyncResult has a stream in it. the problem is that when a client call the metod my function does not returns untill all data is not writed in stream in server... is it possible to change this behavior or I have to use callbacks?

推荐答案

我在这里找到了很好的解决方案

I found great solution herehttp://weblogs.asp.net/cibrax/archive/2008/06/10/streaming-large-content-with-wcf-and-deferred-execution.aspx#6288340

这篇关于带流的WCF块数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 15:28