Saturday, July 24, 2010

Handling SOAP fault exceptions from a WCF service

I was expecting that using catch (Exception ex) would catch the fault (it actually does) and it would be able to retrieve the fault information (not the case). This article showed me how to do it: use catch(FaultException ex).

Actually, I added catch clauses for both the generic exception and the fault exception. Don't forget the generic exception goes after the fault exception, otherwise the fault exception will never get caught.

No comments: