Search code examples
wcfweb-serviceswcf-bindingfirewall

What specific ports do various WCF bindings use for communication?


I've read in various books/articles that some Bindings, for example netTcpBinding and netMsmqBinding can not be implemented over the onternet since the ports they use for communication are blocked by most firewalls. This from page 518 of Juval Lovy's Programming WCF Services:

The MSMQ binding is designed to be employed in the intranet. It cannot go through firewalls by default.

But at the same time I see many articles/tutorials around that do exactly that, implement services with netTcpBinding and netMsmqBinding communication over the internet. I even recently set up a WCF service with netMsmqBinding and from initial tests (though we haven't tested the service in a production environment yet) it seems to work perfectly fine over the internet, albeit after many frustrating attempts and countless tweaks. Anyways, my question is if anybody is able to tell me the port numbers used by different types of bindings and whether it is safe to assume that those ports are open by default on firewalls. Also how advised is it to use netTcpBinding over the internet, I'm trying to host another service which will be called by clients across the internet, I expect to have 100+ clients consuming the service at a given time so performance is critical to me (that's why I'm keen on the idea of netTcpBinding over the internet as opposed to wsHttpBinding).


Solution

  • The default for netTcpBinding is TCP/808.

    There is a Microsoft Howto that describes the ports used by MSMQ in various cases.

    Any service protected by a firewall need to have the right ports opened in the firewall. As long as the ports are open, anything will work across the Internet.

    With that said, there are some ports that should never, ever be opened to the firewall. For a Windows environment that's the generic RPC ports (139, 445), that allow access to Windows file sharing, RPC and remote adimistration. If you open those, you cannot restrict access to just one of the services, anyone who can reach those ports can reach all core Windows services.