尝试调用 wcf 服务时出错

Error while trying to call a wcf service

我正在尝试连接到服务器上的 WCF 服务。

我在服务器的 IIS 中设置了一个站点,并将 Enabled Protocols 设置为 http,net.tcp。 此外,我这样配置 Site Bindings

Authentication 下,我启用了 Anonymous AuthenticationWindows Authentication

服务 Net.Tcp Listener AdapterNet.Tcp Port Sharing Service 也是 运行。

当我使用浏览器调用网络服务时(通过 http),一切正常,我可以列出 wsdl

但是当尝试通过 tcp 连接时,出现以下错误:

Error: Cannot obtain Metadata from net.tcp://myserver/MyService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.tcp://myserver/MyService.svc Metadata contains a reference that cannot be resolved: 'net.tcp://myserver/MyService.svc'. Could not connect to net.tcp://myserver/MyService.svc. The connection attempt lasted for a time span of 00:00:21.0010999. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.x.yyy.zz:808. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.x.yyy.zz:808

提前致谢

我认为您可能需要打开元数据交换: The following explains one way to do it.

这似乎是网络问题,因为 10060 表示连接超时。

  1. 检查服务器防火墙并确保 Windows Communication Foundation Net.TCP Listener Adapter (TCP-In) 规则已启用。

  2. 检查客户端计算机的防火墙并添加确保允许端口 808 上的 tcp 连接的出站规则

  3. 如果您仍然无法连接,网络防火墙设备可能阻止了请求