Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

How to stream data in WCF service operations

Posted on June 1, 2009

Bruce Zhang has put together a great post about stream operations in WCF.

I have never liked the limitations imposed with streaming in WCF although I do agree with the design. The biggest issue for me is that WCF needs to be configured for a maximum transfer size. The main problem here is that a service and a client will probably not know the maximum size of data that a service could process. To know the maximum size would require a business rule in the service design and that would not be very common for a service that handles large amounts of data via a stream.

I prefer a chunking service design as you get around all of these limitations with the one disadvantage of creating a chatty service. This introduces a little overhead but I think it is worth it for the benefit of avoiding WCF streaming restrictions.