WCF autogenerate FaultContracts

285 views Asked by At

We have many WCF services, we have not been using contract first. So now we have a lot of code that throws exceptions, that are not specified in the FaultContracts.

Other than manually inspecting the code. Is there a way to generate FaultContracts or at least get a warning when a FaultContract is missing?

1

There are 1 answers

2
pmarflee On

The Microsoft Enterprise Library Exception Handling Block has a feature which allows exceptions to be declaratively mapped to faults at the service boundary level. This means that you don't have to explicitly raise the faults yourself; they will be created for you by the block when an exception reaches a service boundary. See this article for more details.

However this won't help you identify service operations which are missing fault contracts. I'm not aware of a tool which can do this, so you may have to write your own.