I\'m trying to build a SOA where clients can perform long running queries on the server and the server responds using a callback.
I\'d like to be able to detect if t
try this to check if the callback object is still valid:
(((ICommunicationObject)myCallbackObject).State == CommunicationState.Opened)
myCallbackObject in this case is the object through which you can perform the callback, i.e. the one implementing the callback contract
In his 'Programming WCF Services' book, Juval Lowy explains that WCF does not provide a mechansim for managing service callbacks, and this must be managed by the service and client explicitly. If the service attempts to invoke a callback which has been closed on the client, an ObjectDisposedException will be thrown on the service channel.
He recommends adding a Connect and Disconnect method to the service contract - since the callback must be provided to the service when these are called, the service can manage client callbacks. It is then up to the client to ensure that it calls Disconnect when it no longer wishes to recieve callbacks from the service, and the service must handle any exceptions when invoking callbacks to the client.