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.
精彩评论