防火墙后面的 WCF 服务如何设置端口转发?
我刚刚开始接触 WCF 编程。我在我的工作计算机上设置了一个自托管测试 Web 服务,该计算机位于防火墙后面;它位于http://localhost:8000/MyTestService
。我可以通过浏览器访问服务页面;一切正常。
现在我想从位于不同网络的家用计算机访问该服务。我设置了一个动态 dns(称为 mydomain.dyndns.org)来指向我的工作路由器。经测试,dyndns 指向正确的地址。
现在我已经在我的家用计算机上安装了一个测试应用程序来连接到我的网络服务。因此,我将 NAT 配置为将端口 8000 上的请求转发到我的工作计算机上的相同端口号。
现在,我在家用计算机上打开浏览器并导航到 http://mydomain.dyndns.org:8000/MyTestService
。无所事事。
显然,我错过了有关 NAT 和端口转发的一些非常基本的东西...但正如我所说,我在编程的这方面有点新,我真的很感谢这里的一些指导!
I'm just getting into WCF programming. I've set up a self-hosted test web service on my work computer, which is behind a firewall; it's at http://localhost:8000/MyTestService
. I can access the service page through the browser; all working fine.
Now I want to access that service from my home computer, which is on a different network. I have a dynamic dns (call it mydomain.dyndns.org) set up to point to my work router. Have tested, dyndns is pointing to the right address.
Now I have installed a test app on my home computer to connect to my web service. So I configured my NAT for forward requests on port 8000 to my work computer, on the same port number.
On my home computer I now open a browser and navigate to http://mydomain.dyndns.org:8000/MyTestService
. Nothing doing.
Obviously I'm missing something really fundamental about NATs and port forwarding... but as I say, I'm kinda new at this aspect of programming, and I'd really appreciate some guidance here!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您看到错误或空白页面吗?您可以从防火墙后面的计算机检查 canyouseeme.org 端口是否确实打开?您可以使用 sysinternals tcpview 等工具检查连接尝试是否到达此计算机而不仅仅是路由器?
Do you see an error or an empty page? Can you check canyouseeme.org from the computer behind the firewall that the port is really open? Can you check with tools like sysinternals tcpview that the connection attempt reaches this computer and not just the router?
我也有同样的问题。
在这个主题的良好帮助之后。 http://www.codeproject.com/Questions/140317/ WCF 服务和 Windows 防火墙。即使防火墙处于活动状态,我的 WCF 服务在本地 LAN 上也能正常运行。
但无法通过互联网访问。
端口转发后我可以看到服务描述。但我无法使用它。
本文 http://gavinmckay .wordpress.com/2009/03/24/howto-fix-wcf-host-name-on-iis/ 为我指明了正确的方向。
该服务是可见的,但与您的 Web 服务器的连接将失败,因为 WSDL 指向未发布的服务器名称,并且您的客户端将无法到达那里。
就我而言,我需要将自托管 wcf 本地端点更改为公共端点。
I had the same problem.
after a good help from this toppic. http://www.codeproject.com/Questions/140317/WCF-services-and-Windows-Firewall. My WCF Service worked well on the local LAN even with the firewall active.
But it was not accessible over the internet.
After port forwarding i could see the service description. but I couldn't use it.
This article http://gavinmckay.wordpress.com/2009/03/24/howto-fix-wcf-host-name-on-iis/ points me in the right direction.
The service is visible, but connections to your web server will fail because the WSDL is pointing to the non-published server name and your client won’t be able to get there.
In my case a I need to change the self hosted wcf the local endpoint to the public one.