tags:

views:

24

answers:

2

I am using a WCF to upload a file to a server.

public interface IFileTransferService
{
  [OperationContract]
  void UploadFile(Stream stream);
}

The problem here is, that I don't get information on whether the operation was succesful or not. Of course I may get an exception when the server does not respond, but how can the server report an specific error to the client.

Is this scenario supported by WCF? I am using .NET 4.0 both on the server and client. How else could I archive the desired behavior?

Thanks for your help!

A: 

You can modify your UploadFile operation to return value / DataContract instead of void to report operation result.

Ladislav Mrnka
Ok, it first didn't work for me because of another thing and first I didn't see the actual exception.
ollifant
+2  A: 

If the call completes no error has occured. You should also wrap the call in a try-catch block and check for FaultExceptions.

Also what Ladislav said: add a return value.

Flo