WCF 自动生成故障契约

发布于 2024-08-09 10:26:27 字数 140 浏览 12 评论 0原文

我们有很多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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一枫情书 2024-08-16 10:26:27

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文