views:

943

answers:

1

In WCF, contracts can be switched to streaming mode, to transfer large messages.

After reading and testing it seems to me, that streaming mode can not be used with duplex channels (channels with OneWay-calls and a callback interface).

Is this so? Do duplex and streaming can not be used with each other? Or is there a way?

(I'm trying to upload a large file to the service and use callback to report progress on this)

A: 

Out of curiosity I was about to start some testing on your question but then Google revealed to me the two samples which might answer your question better.

This CodeProject example shows streaming file transfers with a progress bar without using Duplex channels.

This sample shows more of the same but with some different disposing of the stream.

Also, a really good resource for all things WCF related is iDesgin.net. The main guy there is Juval Lowy who wrote some of the best books regarding WCF. They have dozens of excellent WCF examples you can download (although they annoyingly ask your for your email address for each one). More importantly, they also wrote a ServiceProcessEx class which greatly extends what ServiceProcess can do, especially in regards to Duplex channels. (I'm not sure if it deals much with streaming though... its not something I've done yet).

Hope some of this is helpful to you.

Sailing Judo