Streaming Data from a WCF Service

MTOM is useful for encoding large binary data objects in messages, but if these objects become too large they can consume significant amounts of memory in the computer hosting the WCF service and the client applications that receive them. Additionally, very large messages can take a long time to construct and transmit, and it is possible that the client application could time-out while waiting for a response containing a large binary object.

In many cases, it does not make sense to even attempt to try and package up data into a single message. Consider a WCF service that provides an operation that emits audio or video data. In this scenario, it is far more efficient to send the data as a stream than to try and ...

Get Microsoft® Windows® Communication Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.