如何使用net.tcp端点从远程服务器ping或检查WCF服务的状态? [英] How to ping or check status of WCF service using net.tcp endpoint from remote server?

查看:186
本文介绍了如何使用net.tcp端点从远程服务器ping或检查WCF服务的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的来自 Http 的世界,从来没有对使用TCP的旧.NET Remoting做过很多事情,但是我了解TCP的概念,现在已经实现了几个WCF最近几年使用net.tcp绑定的服务。在大多数情况下,它运行,运行,我消耗它,故事结束。但是,有时服务器设置会更高级,并且我会收到一台服务器上存在的通信错误,而可能不是来自另一台服务器。证明它是否是防火墙/服务器/等。问题我需要查看WCF服务是否可以完全看到或到达。这是针对使用net.tcp的Windows Service托管WCF服务的,我正在尝试解决这种情况。

I really come from the world of Http and never did much with the old .NET Remoting which used TCP, but I understand the TCP concepts and now have implemented several WCF services using the net.tcp binding over the last few years. Most of the time it is up, running, I consume it, end of story. However sometimes the server setup is more advanced and I get communication errors that exist on 1 server and maybe not from another. To prove if it is a firewall/server/etc. issue I need to see if the WCF service can even be seen or reached without issue. This is for a Windows Service hosted WCF service using net.tcp that I am trying to figure out this situation.

问题在于通过HTTP绑定公开的WCF服务,我只需在浏览器中放置URI即可查看服务页面,让我知道服务运行正常。简单测试。

The thing is with a WCF service exposed via a HTTP binding, I can just plop the URI in the browser to view the service page letting me know the service is running properly. Easy test.

对于通过net.tcp绑定公开的WCF服务,我该如何做?是否可以使用任何工具或命令来测试例如 net.tcp // mycustomWCFService:8123 / MyService ?我已经看到了几篇有关编写代码以编程方式确定WCF服务是否可用的文章,但我不想这样做。我想检查一下是否完全没有 代码,类似于我在浏览器中拉起http端点。

How do I do the equivalent for a WCF service exposed via a net.tcp binding? Is there any tool or command I can use to test for example net.tcp//mycustomWCFService:8123/MyService ? I have seen a few posts on writing code to programmatically determine if the WCF service is available but I do not want to do it this way. I want to do this check if at all possible without code, analogous to me pulling up the http endpoint in a browser.

任何帮助都是感谢,谢谢!

Any help is appreciated, thank you!

推荐答案

如果您的服务实现了元数据终结点(通常命名为 mex 并嵌套在主体端点(在本例中使用 mexTcpBinding 实现)下,您可以使用Visual Studio随附的svcutil命令行实用工具对其执行 ping操作。例如,

If your service implements a metadata endpoint (typically named mex and nested beneath the principal endpoint, implemented using the mexTcpBinding in this case), you can "ping" it using the svcutil command line utility that's provided with Visual Studio. E.g.,

svcutil net.tcp://mycustomWCFService:8123/MyService/mex

如果引发错误,则表明您的服务已关闭。如果成功,则说明您(可能)从事业务。正如前面的括号所建议的那样,这是一个近似值。这意味着该地址处有一个侦听器,并且能够处理元数据请求。

If it throws an error, your service is (potentially) down. If it succeeds, you're (likely) in business. As the preceding parentheticals suggest, it's an approximation. It means there's a listener at the address and that it's able to service a metadata request.

这篇关于如何使用net.tcp端点从远程服务器ping或检查WCF服务的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆