views:

647

answers:

2

I'm connecting to a service and using a Channel created by ChannelFactory. I would like to know what exceptions can be thrown while invoking service interface's methods (for example if there is a service interface named ICalculator and I'm invoking its Add(5, 4)). I can't google the topic because i don't really know how to name the problem and what exactly i'm looking for. I will be grateful for any link with that kind of information.

i mean exceptions about corrupted connection etc., not the exceptions specified by the creator of the service.

A: 

I suspect just about any type of exception you care to throw. Why would only certain exceptions be allowed?

Greg Dean
-1: Exceptions thrown by the service implementation won't propagate to the client. Instead a SOAP fault will be propagated which the client will see as a FaultException.
Joe
The question mentions nothing about propagating Exceptions to the caller
Greg Dean
+2  A: 

You can get:

  • FaultException or derived class (FaultException<T>) if an unhandled exception is thrown by the service implementation.

  • CommunicationException if an error occurs communicating with the service.

There may be others but these are the ones you will typically handle.

Joe
I typically handle EndpointNotFoundException as well.
Bermo
"I typically handle EndpointNotFoundException " - this is derived from CommunicationException, so (a) you only need to handle it explicitly if you want to handle it differently from other CommunicationExceptions, and (b), if you do handle it you must catch it *before* catching CommunicationException.
Joe