WCF 无法建立连接,因为目标机器主动拒绝 [英] WCF No connection could be made because the target machine actively refused
问题描述
我刚刚使用 net.tcp
实现了一个简单的 WCF 服务器.
I just implemented a simple WCF server using net.tcp
.
首先,我使用 127.0.0.1
作为服务器地址和客户端能够连接 WCF 服务.
First, I use 127.0.0.1
as server address and client able to connect the WCF service.
一切正常.但是当我尝试使用内部 IP 192.x.x.x
时出现错误:
Everything is Ok. But when I try to use the internal IP 192.x.x.x
I get an error:
无法建立连接,因为目标机器主动拒绝
No connection could be made because the target machine actively refused it
知道是什么原因造成的吗?
Any idea what may cause this?
祝福
PS:我在 WCF 上禁用了身份验证.甚至关闭防火墙...没有工作...
PS: I disabled auth on WCF. Even turn off firewall all...Not worked...
推荐答案
您是否在客户端和服务器上都使用 192.x.x.x?我记得不久前看到一个问题,对于 TCP,客户端和服务器名称需要匹配(与消息属性之一相关),因此如果您使用localhost"定义服务,使用 < 定义客户端.机器名>
会有问题.
Do you use 192.x.x.x on both client and server? I remember seeing an issue a while back in which for TCP the client and server names needed to match (something related to one of the message properties), so if you define the service with "localhost" and the client with <machine name>
there would be a problem.
这篇关于WCF 无法建立连接,因为目标机器主动拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!