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

问题描述:

我们希望通过REST公开我们的WCF服务,并通过TCP使用SSL保护它们。我们有一个有效的SSL上传到Azure和适当的映射设置,以便https://service.ourdomain.com正常工作。在Azure上的WCF上通过SSL配置webHTTP和NetHTTP绑定

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

我觉得我有SSL与webHTTP工作,但是当我试图使httpsTransport自定义为NetHTTP结合我得到的错误

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

所有配置已在WebRole web.config中完成 我已查看了此处提交的其他WCF问题由Silverlight的人和他们帮助通过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> 

两个绑定的端点地址是相同的。尝试改变其中之一到成就/斌什么的。这应该解决你的问题。