excerpts from http://msdn.microsoft.com/en-us/library/ms789010.aspx
To enable streaming, define the OperationContract appropriately and enable streaming at the transport level.
To stream data
To stream data, the OperationContract for the service must satisfy two requirements:
- The parameter that holds the data to be streamed must be the only parameter in the method. For example, if the input message is the one to be streamed, the operation must have exactly one input parameter. Similarly, if the output message is to be streamed, the operation must have either exactly one output parameter or a return value.
- At least one of the types of the parameter and return value must be either Stream, Message, or IXmlSerializable.
GetStream operation receives some buffered input data as a
string, which is buffered, and returns a
Stream, which is streamed. Conversely
UploadStream takes in a
Stream (streamed) and returns a
EchoStream takes and returns
Stream and is an example of an operation whose input and output messages are both streamed.
GetReversedStream takes no inputs and returns a
2. Streaming must be enabled on the binding. You set a TransferMode property, which can take one of the following values:
- Streamed, which enables streaming communication in both directions.
- StreamedRequest, which enables streaming the request only.
- StreamedResponse, which enables streaming the response only.