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

时间:2010-01-25 16:55:25

标签: wcf ssl https wcf-binding azure

我们希望通过REST公开我们的WCF服务,并通过TCP使用SSL保护它们。我们已将有效的SSL上传到Azure并进行了正确的映射设置,以便https://service.ourdomain.com能够正常工作。

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

我认为我有SSL使用webHTTP但是当我尝试在NetHTTP的自定义绑定中启用httpsTransport时,我收到错误

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

所有配置都已在WebRole web.config中完成 我已经看过Silverlight人员提交的其他WCF问题了,他们通过SSL帮助了webHTTP,但二进制文件让我感到难过。

是否可以从同一个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>

1 个答案:

答案 0 :(得分:1)

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