在Azure上的WCF中通过SSL配置webHTTP和NetHTTP绑定

在Azure上的WCF中通过SSL配置webHTTP和NetHTTP绑定,wcf,ssl,https,wcf-binding,azure,Wcf,Ssl,Https,Wcf Binding,Azure,我们希望通过REST和TCP公开我们的WCF服务,并使用SSL保护它们。我们有一个有效的SSL上传到Azure和适当的映射设置,以便它能够正常工作 我已经设置了两个端点绑定,REST服务的webHttpBinding和TCP的NetHttpBinding类型的customBinding 我想我已经使用了SSL来处理webHTTP,但是当我尝试在NetHTTP的自定义绑定中启用httpsTransport时,我得到了一个错误 “无法添加传输元素‘httpTransport’。绑定中已存在另一个传输

我们希望通过REST和TCP公开我们的WCF服务,并使用SSL保护它们。我们有一个有效的SSL上传到Azure和适当的映射设置,以便它能够正常工作

我已经设置了两个端点绑定,REST服务的webHttpBinding和TCP的NetHttpBinding类型的customBinding

我想我已经使用了SSL来处理webHTTP,但是当我尝试在NetHTTP的自定义绑定中启用httpsTransport时,我得到了一个错误

“无法添加传输元素‘httpTransport’。绑定中已存在另一个传输元素。每个绑定只能有一个传输元素”

所有配置都已在WebRole web.config中完成 我已经看了Silverlight的人在这里提交的其他WCF问题,他们帮助了webHTTP over SSL,但是二进制的东西让我感到困惑

如果我想知道,是否可以从同一个SSL域运行REST和TCP WCF服务

<system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="SecureWebHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"  />
      </security>
    </binding>
  </webHttpBinding>

  <customBinding>
    <binding name="NetHttpBinding">
      <binaryMessageEncoding />
      <!--<httpsTransport authenticationScheme="None" />-->
    </binding>
  </customBinding>
</bindings>

<behaviors>
  <endpointBehaviors>
    <behavior name="webBehavior">
      <webHttp />
    </behavior>
   </endpointBehaviors>

   <serviceBehaviors>
    <behavior name="RestService">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

    <behavior name="BinaryService">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

  </serviceBehaviors>
</behaviors>

<services>
  <service behaviorConfiguration="RestService" name="WebService.Rest">
    <endpoint address="Achievements" 
              binding="webHttpBinding" 
              bindingConfiguration="SecureWebHttpBinding" 
              behaviorConfiguration="webBehavior" 
              contract="WebService.JSON.IAchievementJSON"/>
</service>

  <service behaviorConfiguration="BinaryService" name="WebService.Binary">
    <endpoint address="Achievements"
              binding="customBinding"
              bindingConfiguration="NetHttpBinding"
              contract="WebService.BinaryInterfaces.IAchievementBinary"/>
  </service>
 </services>
</system.serviceModel>

两个绑定的端点地址相同。尝试将其中一个更改为成就/bin或其他内容。这会解决你的问题