Deperplexing WCF errors pt. 2 - IsOneWay swallowing exceptions

Tags: .NET, WCF, WinFX

The first step in understanding WCF error messages is making sure you actually get them.

You can have an OperationContract defined with the IsOneWay parameter set to True, thus optimizing it by not requiring a reply message.
Since faults and exceptions are represented as replies to the message sent, however, setting IsOneWay to true will cause WCF to simply swallow the exception and not report it - as far as the framework is concerned the message was sent successfully and that's it.

If you want to use the IsOneWay optimization, it's best to save it for later parts of development, after the basic debugging work is done.

1 Comment

  • Jack said

    Dont use IsOneWay=true if you are expecting error messages back! OneWay means you are using a datagram messaging pattern. This is the most primitive and fundamental way to communicate. It means you are simply firing a message into a black hole. Only messaging abstractions on top of bi-directional (duplex) one-way communication can allow for errors to be communicated back. This is what abstractions like request/response and message correlations give you.

Comments have been disabled for this content.