Reputation: 6958
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?
Upvotes: 2
Views: 2945
Reputation: 18178
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.
Sample message contract:
[MessageContract()]
public class FileTransferRequest
{
[MessageHeader(MustUnderstand = true)]
public string FileName;
[MessageBodyMember(Order = 1)]
public System.IO.Stream Data;
}
Upvotes: 3