tags:

views:

82

answers:

0

why is this working in streamed wcf?


the binding code:

public static NetTcpBinding CreateNetTcpBinding()
    {
        int messageSize = 1024*64;

        XmlDictionaryReaderQuotas readerQuotas =
            new XmlDictionaryReaderQuotas();
        readerQuotas.MaxArrayLength = messageSize*100;


        NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
        tcpBinding.MaxReceivedMessageSize = messageSize*100;
        tcpBinding.ReaderQuotas = readerQuotas;
        tcpBinding.TransferMode = TransferMode.Streamed;

        return tcpBinding;
    }

the contract:

[ServiceContract]
[ServiceKnownType(typeof(Bitmap))]
public interface ISearch
{
    [OperationContract]
    string[] SearchFaces(int cameraID, DateTime from, DateTime to);

    [OperationContract]
    ImagePair GetFace(string path);

    [OperationContract]
    Video[] SearchVideos(int cameraID, DateTime from, DateTime to);

    [OperationContract]
    ImagePair[] FacesCapturedAt(int cameraID, DateTime time);


    [OperationContract]
    string VideoFilePathRecordedAt(DateTime time, int camID);

    [OperationContract]
    System.IO.Stream DownloadFile(string file);

    [OperationContract]
    System.Drawing.Bitmap DownloadBitmap(string file);

}

and this is from msdn:

Operations that occur across a streamed transport can have a contract with at most one input or output parameter. That parameter corresponds to the entire body of the message and must be a Message, a derived type of Stream, or an IXmlSerializable implementation. Having a return value for an operation is equivalent to having an output parameter.

then why my wcf is working?