简体   繁体   English

WCF,部分数据传输

[英]WCF, Part By Part Data Transfer

For example, consider around 10000 records are being sent from WCF service to the calling client. 例如,考虑从WCF服务向呼叫客户端发送大约10000条记录。 As per WCF we can set the response buffer size in the web.config file. 根据WCF,我们可以在web.config文件中设置响应缓冲区的大小。 I want to get the response part by part like 1000 records at a time. 我想一次获得部分响应,例如一次1000条记录。 How can this be achieved without any changes in the web.config file?.. Need help in this regard. 如何在不对web.config文件进行任何更改的情况下实现此目标?。在这方面需要帮助。

Thanks in advance. 提前致谢。

See Large Data and Streaming (MSDN) for information about how to handle your situation. 有关如何处理您的情况的信息,请参阅大数据和流传输(MSDN)

By default, WCF processes messages in buffered mode. 默认情况下,WCF以缓冲模式处理消息。 This means that the entire content of a message is present in memory before it is sent or after it is received. 这意味着消息的全部内容在发送之前或接收之后都存在于内存中。 While that is a good strategy for most scenarios, and necessary for messaging features such as digital signatures and reliable delivery, large messages could exhaust a system's resources. 尽管对于大多数情况而言,这是一个很好的策略,并且对于诸如数字签名和可靠传递之类的消息传递功能而言是必需的,但大消息可能会耗尽系统的资源。

The strategy to deal with large payloads is streaming. 处理大型有效负载的策略是流式传输。 While messages, especially those expressed in XML, are commonly thought of as being relatively compact data packages, a message might be multiple gigabytes in size and resemble a continuous data stream more than a data package. 尽管消息(尤其是用XML表示的消息)通常被认为是相对紧凑的数据包,但消息的大小可能为数GB,并且比数据包更像连续数据流。 When data is transferred in streaming mode instead of buffered mode, the sender makes the contents of the message body available to the recipient in the form of a stream and the message infrastructure continuously forwards the data from sender to receiver as it becomes available 当以流方式而不是缓冲方式传输数据时,发送方将消息主体的内容以流的形式提供给接收者,并且消息基础结构在数据可用时将其从发送方连续转发到接收方

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM