开发者

Why does ClientBase Dispose need to throw on faulted state?

Why does 开发者_如何学运维ClientBase Dispose need to throw on faulted state?


Probably because you need to Abort it first:

An object in the Faulted state is not closed and may be holding resources. The Abort method should be used to close an object that has faulted. If Close is called on an object in the Faulted state, a CommunicationObjectFaultedException is thrown because the object cannot be gracefully closed.

From ClientBase.Dispose doco:

Closes the client object.

You are probably getting CommunicationObjectFaultedException because you are calling Dispose (which calls Close) before aborting. Abort, then Dispose and you should be OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜