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

bes*_*est 5 ssl https wcf wcf-binding azure

我们希望通过REST公开我们的WCF服务,并通过TCP使用SSL保护它们.我们有一个上传到Azure的有效SSL和正确的映射设置,以便访问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>
Run Code Online (Sandbox Code Playgroud)

ste*_*enl 1

两个绑定的端点地址是相同的。尝试将其中之一更改为成就/垃圾箱或其他内容。这应该可以解决你的问题。