开发者

Configuring both webHTTP and NetHTTP bindings over SSL in WCF on Azure

开发者 https://www.devze.com 2022-12-18 12:54 出处:网络
We would like to expose our WCF services over REST and also over TCP securing them both with SSL.We have a valid SSL uploaded to Azure and the proper mapping setup so that going to https://service.our

We would like to expose our WCF services over REST and also over TCP securing them both with SSL. We have a valid SSL uploaded to Azure and the proper mapping setup so that going to https://service.ourdomain.com works as it should.

I have setup two endpoint bindings, webHttpBinding for the REST services and a customBinding of type NetHttpBinding for the TCP.

I think I have SSL working with webHTTP but when I try and enable httpsTransport in the custom binding for NetHTTP I get the error

“Cannot add the transport element 'httpTransport'. Another transport element already exists in the binding There can only be one transport element for each binding”

All the config has been done in the WebRole web.config I’ve had a look at the other WCF questions on here submitted by the Silverlight people and they helped with the webHTTP over SSL but the binary stuff has me stumped.

Is it possible to run both REST and TCP WCF services from the same SSL domain, if so I'd love to know?

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

  <customBinding开发者_如何学C>
    <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>


Your endpoint address for both bindings is the same. Try changing one of them to Achievements/bin or something. This should sort out your issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消