c# - 如何配置 Windows Azure WCF 服务 Web 角色以与 netTcpBinding 一起使用?

标签 c# .net windows wcf azure

我在 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/

相关文章:

c# - 在 ASP.NET 应用程序中使用 flash api 访问 WebCam

c# - 必须声明标量变量 - Dapper

c# - .Net 项目的 TeamCity 增量测试

c# - 带有可选参数的 Web 服务方法

c# - 是否可以将复杂类型属性绑定(bind)到数据网格?

objective-c - 在 Windows 上使用 objective-c 进行 GUI 编程?

c# - 我正在尝试从不同的形式访问公共(public)属性(property),但我似乎无法以第二种形式访问它

C# - DateTimePicker,检测上下点击事件

c# - 我想从使用 c# 运行的 Windows 框中通过 ssh 运行命令

php - Composer 需求开发问题