views:

305

answers:

0

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>
    <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>