Communication listenerState?

Does anyone know how to create a listener for a proxy server so that when changing CommunicationState I can call an action or method?

As an example, I want to update my WCF service to change the code. As the application is in early development, code changes are very frequent. However, instead of annoying my employees with email, tell them that they need to restart their application. I would rather avoid having to restart the application and send them email. I would prefer to write a listener that looks at the communication status of the service, and if it changes to an erroneous one, try connecting again.

Edit

Perhaps there is still some context.

InstanceContext context = new InstanceContext(this);
Subscriber = new SubscriptionService.MySubscriptionServiceClient(context);
Subscriber.Subscribe("");

So basically I want to know when the subscription service has stopped, so I can try to connect every 60 seconds or so. I tried to search for the event in the subscriber service, but did not see anything. Do I need to implement something at the end of the service?

thank

+3
source share
1 answer

You can use the Faulted event available in the property of InnerChannelyour generated client class. A Stateclient class property is just a wrapper for InnerChannel.State, so this should work as you wish.

(For reference, you can also use a similarly named event on ChannelFactory<TChannel>if you create communication channels in code, rather than using generated proxies.)

+1
source

All Articles