title: SSL Configuration for WCF REST Service with Custom Bindings
body: <p>I have a WCF REST service that has to accept a raw input stream from a client. In order to receive the raw stream, I'm using a custom binding in my web.config file. The service works fine if I set it to connect over standard HTTP. However, I'm having difficulty getting it to work over HTTPS. </p>
  
  <p><strong><em>Manual addressing is not supported with message level security. Configure the binding ('CustomBinding', '<a href="http://tempuri.org/" rel="nofollow">http://tempuri.org/</a>') to use transport security or to not do manual addressing.</em></strong></p>
  
  <p>Below is the configuration I'm using for HTTP:</p>
  
  <pre><code>&lt;service behaviorConfiguration="LocalBehavior" name="RestService.CreditService"&gt;
       &lt;endpoint address="" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" contract="RestService.ICreditService" /&gt;
  &lt;/service&gt;
  
  &lt;behavior name="LocalBehavior"&gt;
       &lt;serviceMetadata httpGetEnabled="true" /&gt;
       &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
  &lt;/behavior&gt;
  
  &lt;endpointBehaviors&gt;
      &lt;behavior name="web"&gt;
        &lt;webHttp /&gt;
      &lt;/behavior&gt;
  &lt;/endpointBehaviors&gt;
  
  &lt;binding name="RawReceiveCapable"&gt;
      &lt;webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt;
      &lt;httpTransport manualAddressing="true" maxReceivedMessageSize="524288000"
             transferMode="Streamed" /&gt;
  &lt;/binding&gt;
  </code></pre>
  
  <p>And here is the configuration I'm using for HTTPS:</p>
  
  <pre><code>&lt;service behaviorConfiguration="SecureBehavior" name="RestService.CreditService"&gt;
          &lt;endpoint address="basic" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" name="httpsEndpoint" contract="RestService.ICreditService" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://sitcreditserviceszalecorp.cloudapp.net:3389/CreditService.svc" /&gt;
              &lt;add baseAddress="https://sitcreditserviceszalecorp.cloudapp.net:443/CreditService.svc" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
  &lt;/service&gt;
  
  &lt;behavior name="SecureBehavior"&gt;
            &lt;serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /&gt;
            &lt;serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="true" includeExceptionDetailInFaults="true" /&gt;
  &lt;/behavior&gt;
  
  &lt;binding name="RawReceiveCapable"&gt;
            &lt;webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt;
            &lt;security authenticationMode="CertificateOverTransport"
                    requireSecurityContextCancellation ="true"&gt;
            &lt;/security&gt;
            &lt;httpsTransport manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" authenticationScheme="Anonymous" requireClientCertificate="false" /&gt;
  &lt;/binding&gt;
  </code></pre>
  
  <p>Can anyone point out what I'm doing wrong? Thanks.</p>