本文介绍了ClientBase<"处置vs ClientBase<&gt ;.关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ClientBase<> .Dispose 优于 ClientBase<> .Close 的一个优点是您可以使用甚至在遇到异常时也可以使用语句来调用它.

One advantage ClientBase<>.Dispose has over ClientBase<>.Close is that you can use theusing statement to call it even in the face of exceptions.

a)据我所知,当绑定具有传输会话时,不应使用代理服务器的 Dispose ,因为那样的话,任何服务异常都会导致通道和调用故障处置(依次调用 Close )将引发 CommunicationObjectFaultedException ?!

a) To my knowledge, proxy's Dispose shouldn't be used when binding has a transport session, since then any service exception will fault the channel and callingDispose ( which in turn calls Close ) will throw an CommunicationObjectFaultedException?!

b)我假设绑定使用传输会话时,应使用 try-catch 块代替使用语句,其中应在 try block Close 内部调用 catch 中止应该被称为?

b) I assume when binding uses transport session, the try-catch block should be used instead ofusing statement, where inside try block Close should be called, while insidecatch blocks Abort should be called ?

c)是否还有反对使用 ClientBase<> .Dispose 的论点(即使用声明),而绑定没有传输会话?

c) Are there also any arguments against using ClientBase<>.Dispose ( ieusing statement ) when binding doesn't have a transport session?

谢谢

推荐答案

 

 

 

 


这篇关于ClientBase&lt;&quot;处置vs ClientBase&lt;&gt ;.关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 03:48