How to ping a web service like svc, asmx

I have a .net application and I want to ping some web services and show the status on the web page. I tried ping, but I get "There is no such host in the known."

But ping works for url or ip, but does not work for service.

Please post ideas here.

UPDATE:

I used HttpWebResponse and request. I get 401 unauthorized access.

+6
source share
4 answers

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

+3
source

What are you pinging? If you want to check if a web service exists, just go to the full URL of the service and see if the page is found, not or not. On a webpage, you can even get a fantasy and test it with an ajax request (find Microsoft.XMLHTTP) It's funny that you have to ask about it, because every web service I developed is the first method I add to it , is ping :), which returns it in one liner, which can be displayed on the form.

+1
source

What if you are trying to ping a web service address instead of the entire endpoint? Basically, EndPoint consists of an address and a location. Suppose you have the following CustomerService.svc web service.

http://myserver.somedomain.com/services/CustomerService.svc 

You should try ping at myserver.somedomain.com. You should also consider that ping is disabled on some servers.

0
source

You can download an application, such as WCF Storm or SOAP UI , that will act as a client for your WCF service. I think both have free versions. They will allow you to build an XML request to validate the service.

Also, I like to put the actual Ping method in my services, which receives an int and returns a string with the same int and timestamp. This is not strictly necessary, but it helps as a sanity check as a last resort.

0
source

Source: https://habr.com/ru/post/900101/


All Articles