Thursday, September 29, 2011

WCF and Large Packets of data : part 2

 

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

  1. To stream data, the OperationContract for the service must satisfy two requirements:

    1. 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.
    2. At least one of the types of the parameter and return value must be either Stream, Message, or IXmlSerializable.

 

[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
public interface IStreamingSample
{
[OperationContract]
Stream GetStream(string data);
[OperationContract]
bool UploadStream(Stream stream);
[OperationContract]
Stream EchoStream(Stream stream);
[OperationContract]
Stream GetReversedStream();

}





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 bool (buffered).



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 Stream(streamed).



2. Streaming must be enabled on the binding. You set a TransferMode property, which can take one of the following values:




  • Buffered,


  • Streamed, which enables streaming communication in both directions.


  • StreamedRequest, which enables streaming the request only.


  • StreamedResponse, which enables streaming the response only.

Backup Schemes

 

SQL

http://social.msdn.microsoft.com/Forums/en/sqlexpress/thread/5e70a1c9-8495-4c83-8040-897a7c62783e

http://www.sqldbatips.com/displaycode.asp?ID=26

http://expressmaint.codeplex.com/

 

WMI

http://www.vbsed.com/scripts/desktop/restore/scr_317.aspit – restore points

VbsEdit includes all these samples!

Download now! (32-bit version)
version 4.0   -   The evaluation version never expires