views:

1215

answers:

1

Hi, I have a WCF service that is hosted on a Windows Service. Now I want to add file transfer functionality to this service but I have the following questions; considering that transferring files are both ways and files are not big (around 10MB):

1: I have read in MSDN that "Operations that occur across a streamed transport can have a contract with at most one input or output parameter". Does it mean that I cannot have an operation with more than one parameter or what?

2: If I use Streamed for transfer mode, do I have to care about the size of data being transferred in operations whose "in" or "out" parameters are collections?

3: Do I have to change anything else other than the TransferMode in order to set the mode to Streamed?

Thanks.

+1  A: 

Take a look at this post for some direction on WCF file transfer. You should be using the MTOM encoder. The post has a few good reasons why and has some examples.

  1. Yes.
  2. As long as it is all streamed encoded using MTOM the size shouldn't matter. Just make sure you set the maxReceivedMessageSize on the binding configuration.
  3. That and creating a message contract for the messages. See below:

    [MessageContract()] public class FileTransferRequest { [MessageHeader(MustUnderstand = true)] public string FileName;

    [MessageBodyMember(Order = 1)]
    public System.IO.Stream Data;
    

    }

siz