views:

48

answers:

2

I have a wcf service deployed on mulitple machines on the intranet. User can access the machine through internet by connecting its machine through SSL (secured connection of the client network).

User has a client application to consume web service deployed on mulitple machine on client network.

I get the machine name from the client and dynamically create the url to create the client of the web service in client application as below:

https://machine_name//test/testservice.svc

What will be the best approach to check if the machine on which client is trying to connect is valid and running(up)?

There could be mulitple condting when timeout is expired like network delay in among one of the cause..

A: 

you can try and open a telnet on the port you're calling. if it timed out - there is a problem. if you want to do it in more stages 1. run nslookup (to see if the ip-name is defind right) 2. run ping (to see if the machine is alive - if there is no firewall that blocks it) 3. run telnet to the listening port.

What I do - I always publish a test method on the WCF service - that doesn't do anything but returns true - so I can check the service fast.

Dani
A: 

I would recommend using these three commands:

# check we can resolve the host name
host machine_name 

# net cat, to check if the port is open
nc -vz machine_name 443 

# curl to see if the service is responding at the given URL
curl -I https://machine_name//test/testservice.svc

The above commands can be run from within a Cygwin/Unix shell. To do the same within a .NET project, you can download libcurl-net. The curl command/library call will do a complete check, and if it fails it should be able to tell you approximately where the problem is.

brianegge
Can I run these command through code?
Ashish Ashu