I uses netTcpBinding and streaming to send files from one server to another like described in this codeproject article,as I understand In wcf when we want to send stream we should create and return it as message contract, the question is how to get the finish of file sending? cause I want to move file from inbox to outbox when file sent guarantee completed
I found great solution in this blog if someone will need it in the future
OperationContext clientContext = OperationContext.Current;
clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)
{
if (fileStream != null)
fileStream.Dispose();
});
When the second server has finished receiving the file from the first server, it could then call another web service method to acknowledge that it got the file. At that point, you can move the file from inbox to outbox with a guarantee that the other server received it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With