Resuming a WCF duplex connection from the client

70 views Asked by At

I have a client that connects to a server which can potentially go down and come back up a few times a day. So far at the clients I'm using the following method to check for a faulted connection, the on faulted handler re-establishes a connection back to the server:

ICommunicationObject communicationObject = this as ICommunicationObject;
communicationObject.Faulted +=
   new EventHandler((sender, e) => { OnFaulted(sender, e); });

Can anyone advise on the best possible (best practice) way to maintain a persistent duplex connection from the client side?

Extra Info:

With the above code where 'this' is the client connection inheriting from DuplexClientBase the handler is not triggered if the server is simply shutdown (application.exit), is there a better way to handle this?

0

There are 0 answers