How to check if a web service is up and running without using ping?

后端 未结 8 984
小蘑菇
小蘑菇 2020-12-30 09:42

How can i check if a method in a web service is working fine or not ? I cannot use ping. I still want to check any kind of method being invoked from the web service by the c

8条回答
  •  清歌不尽
    2020-12-30 10:03

    Powershell is by far an easy way to 'ping' a webservice endpoint.

    Use the following expression:

    Test-NetConnection -Port 4408 -ComputerName 192.168.134.1
    

    Here is a failure response for a port that does not exist or is not listening;

    WARNING: TCP connect to 192.168.134.1:4408 failed
    ComputerName           : 192.168.134.1
    RemoteAddress          : 192.168.134.1
    RemotePort             : 4408
    InterfaceAlias         : Ethernet0
    SourceAddress          : 192.168.134.1
    PingSucceeded          : True
    PingReplyDetails (RTT) : 0 ms
    TcpTestSucceeded       : False
    

    Here is a success result if the address/port is listening and accessible:

    ComputerName     : 192.168.134.1
    RemoteAddress    : 192.168.134.1
    RemotePort       : 4407
    InterfaceAlias   : Ethernet0
    SourceAddress    : 192.168.134.1
    TcpTestSucceeded : True
    

提交回复
热议问题