gpt4 book ai didi

wcf - 关闭和处理 WCF 服务

转载 作者:行者123 更新时间:2023-12-03 22:16:03 25 4
gpt4 key购买 nike

Close ICommunicationObject 上的方法可以抛出两种类型的异常,如 MSDN 概述 here .我明白为什么 Close方法可以抛出这些异常,但我不明白为什么 Dispose服务代理上的方法调用 Close没有 try 的方法周围。不是你的 Dispose方法在你想要的一个地方确保你不抛出任何异常?

最佳答案

它似乎是 .NET 代码中的常见设计模式。这是来自 Framework design guidelines 的引文

Consider providing method Close(), in addition to the Dispose(), if close is standard terminology in the area. When doing so, it is important that you make the Close implementation identical to Dispose ...



这是一个 blog post您可以在其中找到此 System.ServiceModel.ClientBase 设计问题的解决方法

关于wcf - 关闭和处理 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com