I would like to know, if there is any possibility to return anything, when I send data though WCF using streaming? I use netTcpBinding, client and server are in the same local network.
Here is my code:
[ServiceContract()]
public interface IFileTransferService
{
[OperationContract(IsOneWay = true)]
//[FaultContract(typeof(MyFaultException))] // I can't do that
void Upload(FileTransferRequest request);
}
[MessageContract()]
public class FileTransferRequest
{
[MessageHeader(MustUnderstand = true)]
public string FileName;
[MessageBodyMember(Order = 1)]
public System.IO.Stream Data;
}
[DataContract]
public class MyFaultException
{
private string _reason;
[DataMember]
public string Reason
{
get { return _reason; }
set { _reason = value; }
}
}
So, when using Message Contract, the transaction must be one way, I can't return any value, I can't throw exception. How Can I inform client, that operation was successful or not? And send him an error messages for example?