tags:

views:

41

answers:

1

I need to pass a memory stream to the WCF server , how do i need to add this data type in my data contract. I will eventually need to convert this to a memory stream and pass it on to my service layer.

datacontact[DataMember]

 Stream str = null; 

        public Stream File
        {
            get { return str;   }
            set { str = value;  }

        }
A: 

Here is the WCF Streaming page. I'm not really sure if (how) you can do this with a DataContract, the normal way is to specify streams in the OperationContract. Wouldn't that work for you?

Short summary:

  • Sender produces the Stream
  • Sender does not Close the Stream
  • Receiver does close the stream
  • Set the MaxReceivedMessageSize property of the binding to a value larger than the largest item you wish to transfer.
Henk Holterman