Praneeth
Praneeth

Reputation: 2547

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.

Upvotes: 7

Views: 17887

Answers (4)

David Silva Smith
David Silva Smith

Reputation: 11706

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

Upvotes: 3

FishBasketGordo
FishBasketGordo

Reputation: 23142

You can download an application such as WCF Storm or SOAP UI that will act as a client to your WCF service. Both have free versions, I believe. They will let you construct an XML request to test the service.

Also, I like to put an actual Ping method in my services that receives an int and returns a string with the same int and a timestamp. It's not strictly necessary, but it helps as a sanity check in a pinch.

Upvotes: 0

MartyTPS
MartyTPS

Reputation: 530

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.

Upvotes: 1

Michael Hidalgo
Michael Hidalgo

Reputation: 307

What if you try to ping the Web Service address instead of the entire End Point? Basically an EndPoint is composed by an Address an a location.Let's suppose you have the following Web Service called CustomerService.svc.

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

You should try the ping to the address which is myserver.somedomain.com.Also you should consider that some servers have the ping command disabled.

Upvotes: 0

Related Questions