user2167861
user2167861

Reputation: 179

SSL Configuration for WCF REST Service with Custom Bindings

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.

Manual addressing is not supported with message level security. Configure the binding ('CustomBinding', 'http://tempuri.org/') to use transport security or to not do manual addressing.

Below is the configuration I'm using for HTTP:

<service behaviorConfiguration="LocalBehavior" name="RestService.CreditService">
     <endpoint address="" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" contract="RestService.ICreditService" />
</service>

<behavior name="LocalBehavior">
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>

<endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
</endpointBehaviors>

<binding name="RawReceiveCapable">
    <webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    <httpTransport manualAddressing="true" maxReceivedMessageSize="524288000"
           transferMode="Streamed" />
</binding>

And here is the configuration I'm using for HTTPS:

<service behaviorConfiguration="SecureBehavior" name="RestService.CreditService">
        <endpoint address="basic" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" name="httpsEndpoint" contract="RestService.ICreditService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://sitcreditserviceszalecorp.cloudapp.net:3389/CreditService.svc" />
            <add baseAddress="https://sitcreditserviceszalecorp.cloudapp.net:443/CreditService.svc" />
          </baseAddresses>
        </host>
</service>

<behavior name="SecureBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>

<binding name="RawReceiveCapable">
          <webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <security authenticationMode="CertificateOverTransport"
                  requireSecurityContextCancellation ="true">
          </security>
          <httpsTransport manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" authenticationScheme="Anonymous" requireClientCertificate="false" />
</binding>

Can anyone point out what I'm doing wrong? Thanks.

Upvotes: 0

Views: 464

Answers (1)

Ian Moore
Ian Moore

Reputation: 1

I had the same issue until I came across an article suggesting to remove the security element. That worked for me.

Upvotes: -1

Related Questions