关闭和处理WCF服务

前端之家收集整理的这篇文章主要介绍了关闭和处理WCF服务前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
ICommunicationObject上的Close方法可以抛出两种类型的异常作为MSDN轮廓 here.我明白为什么Close方法可以抛出这些异常,但我不明白的是为什么服务代理上的Dispose方法调用Close方法而不使用试试吧.你的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设计问题的解决方法

原文链接:https://www.f2er.com/html/230900.html

猜你在找的HTML相关文章