Indicates whether a channel uses streamed or buffered modes for the transfer of request and response messages.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Silverlight transports support two modes of transferring messages:
Buffered transfers hold the entire message in a memory buffer until the transfer is complete.
Streamed transfers only buffer the message headers and expose the message body as a stream, from which smaller portions can be read at a time.
Setting the transfer mode to enables buffered communication in both directions. Setting the transfer mode to enables streaming communication in the response.
Streamed transfers can improve scalability by eliminating the need for large memory buffers. Whether changing the transfer mode actually improves scalability in practice depends on the size of the messages being transferred. Improvements in scalability should be most evident when large messages use streamed instead of buffered transfers.
By default, the HTTP transport uses buffered message transfers. You can set the value of to on the BasicHttpBinding system-provided binding using the property.
For custom built bindings, the transfer mode can be set on the binding element of the transport and this element can then be added to the . For example, create an HttpTransportBindingElement and use the TransferMode property to set the transfer mode when creating a custom binding. The transfer mode can also be set in the configuration section for the custom binding.
The decision to use either buffered or streamed transfers is a local decision of the endpoint for HTTP transports. For HTTP transports, the transfer mode does not propagate across a connection, or to proxy servers or other intermediaries. Setting the transfer mode is not reflected in the description of the service contract. After generating a proxy to a service, you can (it is allowed but not required) edit the configuration file for services intended to be used with streamed transfers to set the transfer mode.
The following code sample shows setting the property to through code:
HttpTransportBindingElement transport = new HttpTransportBindingElement(); transport.TransferMode = TransferMode.StreamedResponse; BinaryMessageEncodingBindingElement encoder = new BinaryMessageEncodingBindingElement(); CustomBinding binding = new CustomBinding(encoder, transport);
The following sample shows property to through configuration:
<customBinding> <binding name="streamingBinding"> <binaryMessageEncoding /> <httpTransport transferMode=”StreamedResponse” /> </binding> </customBinding>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.