1

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!

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387

2 Answers2

4

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?

fejesjoco
  • 11,763
  • 3
  • 35
  • 65
  • 1
    You need 3 things: a port forwarding, an open port on the router, and an open port on your computer. You might need to open the port on the router's firewall in addition to adding a port forward. It's also possible that your computer's firewall doesn't accept incoming connections from outside, only on localhost. – fejesjoco Dec 24 '10 at 11:06
  • Aha, here's a clue: canyouseeme.org cannot see that port! I tried port 8000 and port 18000, forwarding to my port 8000 on my computer; both failed. The RDP port (3389) does work, though. And when I set up another port (13389) to forward to my port 3389, that also works. So obviously my port 8000 on my computer is not responding properly. Now what? – Shaul Behr Dec 24 '10 at 11:12
  • Opened the firewall on my computer to port 8000 - working now! THANK YOU! – Shaul Behr Dec 24 '10 at 11:16
2

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.

        // 1 Create a URI to serve as the base address.
        Uri baseAddress = new Uri("http://publicdomain.com:8000/GettingStarted/");
        // Step 2 Create a ServiceHost instance
        ServiceHost selfHostRemote = new ServiceHost(typeof(MyService), baseAddress);