开发者

WCF autogenerate FaultContracts

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 s开发者_运维技巧pecified 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜