I have .net application and I want to ping some webservices and show the status on a webpage. I tried ping but i am getting "No such host in known".
But the ping works for a url or ip but not working for a service.
Please put ideas here
UPDATE:
I used HttpWebResponse and request. I am getting 401 unauthorized.
Within the prompt, type "cmd" followed by a space and the IP address or domain name you want to ping. For example, you might type "ping www.example.com" or "ping 127.0. 0.1." Then, press the "enter" key.
Summary. The ping service detects whether or not a web service is running at the specified URL.
The best and simples way to perform ping operations is relying on the Ping class on the System. Net. NetworkInformation namespace. This class allows you to ping an endpoint and to check all the values that you usually get when you run this command on the command line.
Use a head HTTP verb to check. "This method is often used for testing hypertext links for validity, accessibility, and recent modification."
What are you pinging? If you want to check to see if a webservice is there, then just navigate to the full URL of the service and see if you get a page not found or not. In a webpage, you could even get fancy and check it using an ajax request (look up Microsoft.XMLHTTP) Funny you should ask this because every webservice I have developed, the first method I add to it is ping :) which returns it's state in a one liner that can be displayed on a form.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With