WCF: How to check server availability?

I have a WCF server and a WCF client. When a new version of the client is deployed, I want to check if it is ready to work, so I have to check if the server is on the network.

I don’t want to make any real server calls (because calls can change production data) or to create empty {...} "Test" methods on the server that do nothing.

Is it possible to check for a WCF server endpoint and listen for connections without method calls?

I tried:

factory = new ChannelFactory<IServer>())
factory.CreateChannel();

and

factory = new ChannelFactory<IServer>())
factory.Open();

but there are no exceptions if the server is down. How to check server presence without calling server method?

Thank you in advance!

+3
source share
1 answer

, , , . , , . , , .

, :

  • Ping , true. , .
  • , , , WCF (EndpointNotFoundException IIRC) . , - , .
+5
source

All Articles