How to check if a web service is available using .NET.

If a .NET application needs to call a web service, is there a good solution for checking the availability and accessibility of a web service outside of a call to a specific web method?

In my web services, I usually include some type of definition method for testing, but this becomes a problem when using a third-party web service.

+3
source share
3 answers

Another solution is to simply perform simple HTTP access at the service URL. And look at the response code (i.e. 404, etc.). The nice thing is that you do not need to publish any data or call any methods.

+2
source

, , -. , - .

-, . true/false, false . true; false, , , - ..

0

Nope.

One thing you can do is create a ServiceIsUp method that does nothing, only returns true. If your server freezes for any reason, your request will time out.

0
source

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


All Articles