I have a WCF server which maintains a reference to a client callback using a duplex model.
If I explicitly close the callback connection on the server:
ICallBack callBack = OperationContext.Current.GetCallbackChannel<ICallBack>();
callBack.Close()
The client fails to receive notification of this event through subscribing to either of:
client.InnerChannel.Closed += Handler;
client.InnerDuplexChannel.Closed += Handler;
Neither event handler is executed.
However, if I change the callback to an Abort
instead of a Close
on the server-side, the client receives notification of the Faulted
handler and then subsequently the Closed
handler. So aborting works as expected.
I've checked the callback is in a valid state so why is it the client is receiving the Faulted
notification on Abort
and NOT the Closing
notification on Close
? The state of the callback after Close
is Closed
.
As per the MSDN documentation gracefully closing the callback connection using Close
would be my preferred choice over the more abrupt Abort
.