简体   繁体   English

WCF:如何在端口80上配置net.tcp通信

[英]WCF: How to configure net.tcp traffic on port 80

I have a WCF service that is configured to run for a high port number (eg 9000) on netTcpBinding. 我有一个WCF服务,该服务配置为在netTcpBinding上为较高的端口号(例如9000)运行。 It all works, but only if the client can access data on that port. 一切正常,但前提是客户端可以访问该端口上的数据。 We've had a number of cases where corporate firewalls have not allowed us to connect on this port without a lot of pain. 在很多情况下,公司防火墙不允许我们毫不费力地在此端口上进行连接。

Is there a way I can configure it to work on port 80 without affecting the web applications that are running on the server currently, so that most corporate environments don't need to change anything? 有没有一种方法可以将其配置为在端口80上工作,而又不影响服务器上当前正在运行的Web应用程序,从而使大多数公司环境都不需要进行任何更改? I am aware of .net tcp port sharing, but this won't allow port 80 over net.tcp. 我知道.net tcp端口共享,但这不允许net.tcp上的端口80。

If it's not possible to configure net.tcp over port 80, are there any "best practices" for this kind of situation to minimize the firewall issues? 如果无法通过端口80配置net.tcp,是否有针对此类情况的“最佳实践”以最大程度地减少防火墙问题?

I suggest you could try port 8080 which is allowed in most firewalls. 我建议您尝试使用大多数防火墙允许的端口8080。 IIS 7.0 currently doesn't support sharing same port between different protocol binding. IIS 7.0当前不支持在不同协议绑定之间共享同一端口。 So HTTP + TCP on same port won't work. 因此,同一端口上的HTTP + TCP无法正常工作。

You need to make sure that you bind to a specific ip. 您需要确保绑定到特定的IP。 usually, when binding WCF services, people use 0.0.0.0 to accept on any ip. 通常,绑定WCF服务时,人们使用0.0.0.0接受任何IP。 If you do that on port 80 or not specify a port, it will override all existing configurations in IIS, effectively killing all running sites. 如果在端口80上执行此操作或未指定端口,它将覆盖IIS中的所有现有配置,从而有效地杀死所有正在运行的站点。

The only way to do this is to have a separate IP that you can use for the port 80 binding, that the other sites are not using to connect. 唯一的方法是拥有一个可用于端口80绑定的单独IP,其他站点将不使用该IP进行连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM