let's suppose my WCF service is deployed on ineternet then how can I verify at run time that if particular service is up or not?
let's say my service can be accessed through url:
http://ipaddress开发者_如何转开发/URI
Check the below links:
- WCF - have client check for service availability
- How to check the availability of a net.tcp WCF service
You would have to have some kind of a "ping" function or something on your service - which would e.g. return some arbitrary text (possibly the version number of your service or something).
This will work ....
But: how does this really help you?? A split fraction of a second later, when another call comes in, the network could be clogged or a cable disconnected or something.
Such a "keep alive" or "ping" function doesn't really help much - in reality, when calling a service, you must always be prepared for it to fail. No matter how many times you check for the service to be alive beforehand - when you make your actual service call, it might still fail miserably. Be prepared for that and handle it properly!
How about using the expected client of your service to call the WCF service pointing to the URL. If client is not available try using a generic testing tool like SOAPUI.
精彩评论