Passing a very large collection via WCF streaming

Posted on 2011-10-08
Last Modified: 2012-05-12
Hi, guys!

I have to pass a huge number of some objects from my WCF service to a client. So, I configured my service to use strieamingresponse. The interface looks like:

[ServiceContract(Namespace = "")]
public interface IHistoryRecoveryService
  Stream RecieveTrades (MarketFeed feed, TradeStamp start, TradeStamp end);		

Open in new window

But, all examples of streaming implementation are about passing some files (FileStream). Could anybody send me a link to a more complex example like my task?

I guess, I have to inherit "Stream" and implement my stream, retrieving my object from DB at calling Read.

Question by:alexf2
    LVL 18

    Assisted Solution


    Does this help?



    Accepted Solution

    Thanks, Darren!

    I implemented custom Stream as well as in the eaxample.

    By the way: here ( is an another approach.

    But, it forces client to use XmlReader reader = message.GetReaderAtBodyContents(). I send my data  in binary format (serialized by ProtoBuff-Net).

    Author Closing Comment

    A different possible approach.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now