Detect if wcf service is activated

I am making a WP8 application. I noticed that if the server is working, everything is working fine, but if the server is not working, I get an exception.

How can I check the code if the wcf service is activated before using its methods?

+4
source share
3 answers

Add the no-op method to your web service and call it with a low timeout. If it works, the service is completed. If the call does not work for some reason, the service does not work.

Actually, why does the server work regularly? It may be easier to ensure that it is available at all times.

+3
source

, , Ping(), - , , .

, , , :

public bool IsRunning() { return true; }

try-catch FaultException. true, , . , - WCF Faulted .

+1

There is no way to find out. This is truly an exceptional case. If you make sure that the server is not working, try downloading it or try downloading a simple static file, for example, a text / html file, as the size is smaller. the answer is inaccurate, but this is the same case as you.

0
source

All Articles