WCF 自动生成故障契约
我们有很多WCF服务,我们并没有首先使用契约。所以现在我们有很多抛出异常的代码,这些异常没有在FaultContracts 中指定。
除了手动检查代码之外。有没有办法生成FaultContracts或者至少在FaultContract丢失时得到警告?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Microsoft 企业库异常处理块具有允许将异常以声明方式映射到服务边界级别的故障的功能。这意味着您不必自己明确地提出错误;当异常到达服务边界时,它们将由块为您创建。有关更多详细信息,请参阅这篇文章。
但是,这无法帮助您识别缺少故障合同的服务操作。我不知道有什么工具可以做到这一点,所以你可能必须自己编写。
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.