Tutorial :WCF - EndpointNotFoundException, There was no endpoint listening


My WCF Service is hosted under Windows Service and in case it is not running when client makes a call to its methods, client gets the EndpointNotFoundException with this message:

There was no endpoint listening...

Is there a way I can check if the WCF service is up and running before making calls to the service methods?

Thank you!


Besides just calling it?

You could try pinging it, but that would just tell you that it exists and that its running, not that it's able to accept calls or anything.


To ping the web service you can use the Ping class from System.Net.NetworkInformation.


A solution may be to make a 1st 'dummy' call, if that exception is encountered conclude that it's not running.


You could expose the service contract as WSDL, if possible. If you can reach the WSDL page, then it's running, otherwise it's not.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »