I have problems / questions blocking the reverse / duplex communication channel. Here are my prototype WCF interfaces:
[ServiceContract(CallbackContract = typeof(IMyInterfaceCallback))] public interface IMyInterface { [OperationContract] void StartWork(); } public interface IMyInterfaceCallback { [OperationContract(IsOneWay = true)] void WorkFeedback(); }
On the client side, I create my WCF interface with:
DuplexChannelFactory<IMyInterface> dcf = new DuplexChannelFactory<IMyInterface>(implOfIMyInterfaceCallback, customBinding, ea); IMyInterface myInterface = dcf.CreateChannel();
On the server side, I use
OperationContext.Current.GetCallbackChannel<IMyInterfaceCallback>();
to get a callback pointer, which can then be used to communicate with the client.
Now my questions are:
- Who should close the communication channel? Client or server
- What communication objects need to be closed? Source interface (IMyInterface) or callback interface (IMyInterfaceCallback) or both.
I tried to close the server-side callback interface while the server knew that it would no longer make callbacks. Using ICommunicationObject :: Close on the callback interface, however, resulted in a one-minute lock operation.
Closing on the client side, in my opinion, is wrong, since the client does not know if there are more callbacks.
Thanks for any help. Franc
PS: This seems to be a very simple question, but so far I have not found useful information when searching through google or in stackoverflow ...
Franke
source share