I have a custom stream that I am using with WCF for large BLOBs from the database. It reads the data in chunks.
What is the best way to handle the connection for the stream? Should I just open it at the construction or open/close it with each chuck read?
Thanks.
I would load the entire blob into a memory stream then let WCF handle the Streaming and Chunking. You can enable streaming in the transportBindings, or look into using MTOM.
If you using SQL Server 2008 try sending the stream directly through to the WCF Client
See this link on Streaming Messages with WCF