我在 Windows Azure 上托管了一个 WCF 服务,最近我刚刚将其合约更改为 Duplex 合约(以支持客户端上的进度条)。我首先使用了 wsDualHttpBinding,它在我的本地计算机上运行良好,但正如预期的那样,一旦部署它就无法运行。
我现在尝试将服务配置为与 netTcpBinding 一起使用,但收到错误“指定的协议(protocol)无效。当前不支持名为“Endpoint1”的绑定(bind)的协议(protocol)“tcp”。”。
服务定义.csdef:
<Endpoints>
<InputEndpoint name="AlertsEndpoint" protocol="tcp" port="3030" />
</Endpoints>
Web.config:
<services>
<service name="AlertsService.AlertsService" behaviorConfiguration="AlertsServiceBehavior">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcp" contract="AlertsService.IAlertsService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="MexTcp" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="NetTcp" />
</netTcpBinding>
<mexTcpBinding>
<binding name="MexTcp"/>
</mexTcpBinding>
</bindings>
最佳答案
托管 WCF 服务的
Web 角色
不支持 TCP 协议(protocol)。
您需要在辅助角色
中托管您的 WCF 服务。
网络角色:
Web roles in Windows Azure provide support for the HTTP and HTTPS protocols...
worker 角色:
...and allow the process to communicate externally using a variety of TCP-based application protocols with the WCF service by using the netTcpBindings binding
关于c# - 如何配置 Windows Azure WCF 服务 Web 角色以与 netTcpBinding 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9463383/