如何ping WCF服务(net.Tcp) [英] How to ping a WCF Service (net.Tcp)
本文介绍了如何ping WCF服务(net.Tcp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过在net.tcp上安装在不同服务器(本地)上的c#代码ping WCF服务
或获取WCF服务的响应/可用性
How to ping a WCF service through c# code which is installed on different server (locally) on net.tcp
or get Response / availability of WCF service
<baseAddresses>
<add baseAddress="net.tcp://localhost/example.User"/>
</baseAddresses>
通过c#代码
Through c# code
推荐答案
您无法ping服务。没有这样的概念。 Ping有一些严格的含义:它是一个实现特殊协议(ICMP)的单独服务和用于ping的实用程序:
http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol [ ^ ],
http://en.wikipedia。 org / wiki / Ping_%28networking_utility%29 [ ^ ]。
因此,如果系统实现协议ICMP(通常应该),则只能选择系统本身。您可以使用类System.Net.NetworkInformation.Ping
ping:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping%28v = vs.110%29.aspx [ ^ ]。
-SA
You cannot ping a service. There is no such concept. "Ping" has some strict meaning: it is a separate service implementing a special protocol (ICMP) and a utility for pinging:
http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol[^],
http://en.wikipedia.org/wiki/Ping_%28networking_utility%29[^].
So, you can only pick the system itself if it implements the protocol ICMP (normally, it should). You can ping using the classSystem.Net.NetworkInformation.Ping
:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping%28v=vs.110%29.aspx[^].
—SA
这篇关于如何ping WCF服务(net.Tcp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文