Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ping a webservice like svc, asmx

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.

like image 251
Praneeth Avatar asked Oct 26 '11 02:10

Praneeth


People also ask

How do I ping a web service URL?

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.

Can you ping a webservice?

Summary. The ping service detects whether or not a web service is running at the specified URL.

Can I ping an endpoint?

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.


2 Answers

Use a head HTTP verb to check. "This method is often used for testing hypertext links for validity, accessibility, and recent modification."

like image 94
David Silva Smith Avatar answered Sep 29 '22 00:09

David Silva Smith


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.

like image 34
MartyTPS Avatar answered Sep 28 '22 23:09

MartyTPS