Search code examples
wcfoperationcontractfaultcontract

WCF: Same Faultcontract on many methods


Take for example a project with 10 services and 20 methods on each service.

All services inherit from a base services which has a security check. The first thing each method does is to make a call to the security check. This throws a security exception if there is a problem.

Question is: Do I need to specify a FaultContract on each method (OperationContract), or can I do it once in a central definition?


Solution

  • No, you need to do it on each and every method - WCF is rather picky and requires explicit settings pretty much for everything (which really is a good thing in the end, I am convinced).

    Marc