C# 使WSHttpBinding服务可从外部连接

C# 使WSHttpBinding服务可从外部连接,c#,wcf,wshttpbinding,C#,Wcf,Wshttpbinding,我已经使用WSHttpBinding创建了WCF服务: ServiceHost svh = new ServiceHost(typeof(MyService)); var httpLocation = "http://" + address + ":4041"; svh.AddServiceEndpoint(typeof(IMyService), new WSHttpBinding(SecurityMode.None), httpLocation); svh.Open(); 我已经在系统中注册

我已经使用WSHttpBinding创建了WCF服务:

ServiceHost svh = new ServiceHost(typeof(MyService));
var httpLocation = "http://" + address + ":4041";
svh.AddServiceEndpoint(typeof(IMyService), new WSHttpBinding(SecurityMode.None), httpLocation);
svh.Open();
我已经在系统中注册了

netsh http add urlacl url=http://+:4041/ user=username
当我试图从本地主机连接到它时,该服务工作正常

但当我将其放在另一台pc上(地址为='localhost'或地址为='ip-of-the-machine')时,连接失败,出现以下异常:

There was no endpoint listening at http://192.168.44.128:4041/ that could accept 
the message. This is often caused by an incorrect address or SOAP action. See 
InnerException, if present, for more details.
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 192.168.44.128:4041
内部异常:

There was no endpoint listening at http://192.168.44.128:4041/ that could accept 
the message. This is often caused by an incorrect address or SOAP action. See 
InnerException, if present, for more details.
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 192.168.44.128:4041
我已经尝试将服务添加到防火墙,但没有帮助

这里有什么问题

更新

以下是来自
netstat-ano
的相关条目。第一个是http端点,无法从外部连接,第二个是net.tcp端点,工作正常:

TCP    [::]:4041              [::]:0                 LISTENING       4
TCP    192.168.44.128:9939    0.0.0.0:0              LISTENING       2120

在命令行提示符下使用“NETSTAT-ano”验证您的服务是否正在侦听指定的端口。勾选后,尝试从客户端框PING服务盒IP。如果两者都成功,则很可能是防火墙和/或网络交换机配置问题。

通过命令行提示符中的“NETSTAT-ano”验证您的服务是否正在侦听指定端口。勾选后,尝试从客户端框PING服务盒IP。如果两者都成功,则很可能是防火墙和/或网络交换机配置问题。

Hey。多亏了你,我才发现了问题所在。显然,防火墙被配置为只允许来自我的软件的请求通过,http侦听器正在另一个进程中运行(?)。我已经为所有进程打开了4041端口,这很有帮助。请更新答案,以便我可以将其标记为正确。多亏了你,我才发现了问题所在。显然,防火墙被配置为只允许来自我的软件的请求通过,http侦听器正在另一个进程中运行(?)。我已经为所有进程打开了4041端口,这很有帮助。请更新答案,以便我将其标记为正确