Sprague
Sprague

Reputation: 1638

Proper error handling with 2.0 style and WCF proxies

Microsoft has provided surprisingly small amounts of information regarding this issue or I do not know enough about the problem to locate the documentation.

When consuming web services using the traditional VS2005 and .NET 2.0 web service proxies, aside from FaultExceptions, what sort of communication exceptions can be thrown and through which assemblies/namespaces.

I am having difficulty locating the equivilent to WCF's ServiceActivationException and CommunicationException from System.ServiceModel - are these the same exceptions?

Upvotes: 0

Views: 66

Answers (2)

John Saunders
John Saunders

Reputation: 161773

An ASMX proxy can throw SoapException, or anything that can be thrown by HttpWebRequest.

However, you have to ask yourself: why do you care? What are you going to do differently between one exception type and another? Can you actually handle any of these exceptions, or will you simply log them and let them propagate (I hope you're not going to catch them and then ignore them).

Upvotes: 0

marc_s
marc_s

Reputation: 754268

Pretty much all WCF related exceptions descend from CommunicationException so if you consult the list of descendant classes in the MSDN documentation, you should be covered.

Exceptions are the generic TimeOutException (from the System.Net namespace) and the QuotaExceeded exception from the System.ServiceModel namespace which surprisingly does not descend from CommunicationException - why that is the case, I don't know.

Upvotes: 2

Related Questions