0
votes

I have a WCF service endpoint that uses WsHttpBinding and BasicHttpBinding with different addresses to allow them to share the endpoint. There is no security on the BasicHttpBinding. The BasicHttpBinding works fine when my service and client are on the same machine. When they are on different machines the BasicHttpBinding fails and I get this error in the service's trace log: The service certificate is not provided. Specify a service certificate in ServiceCredentials.

The error stops happening if I remove the WsHttpBinding from the service's config.

Service's web.config:

<bindings>
    <basicHttpBinding>
        <binding name="MyBasicBinding"
                  maxBufferPoolSize="5242880"
                  maxReceivedMessageSize="5242880" />
    </basicHttpBinding>
    <wsHttpBinding>
        <binding name="MyWsBinding"
                  bypassProxyOnLocal="false"
                  hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="5242880"
                  maxReceivedMessageSize="5242880"
                  allowCookies="false">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            <security mode="Message">
                <message clientCredentialType="None" /> 
            </security>
        </binding>
    </wsHttpBinding>
</bindings>

<services>
    <service name="MyService">
        <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="MyBasicBinding"
           contract="MyFramework.IMyService" bindingNamespace="http://MyFramework/Services/"/>

        <!-- The basic binding fails when the WS binding is present.
             If I remove the WS binding, the basic binding will work. -->
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyWsBinding"
           contract="MyFramework.IMyService" bindingNamespace="http://MyFramework/Services/"/>
    </service>
</services>

FYI I'm using a different address for the basic binding which allows the 2 bindings to share the same endpoint. The URL for WsHttpBinding is http://server/MyService.svc and for BasicHttpBinding is http://server/MyService.svc/basic.

Why does the presence of the WsHttpBinding force the BasicHttpBinding to expect a certificate?

1

1 Answers

1
votes

When the service goes up it needs to ensure all endpoints are valid. Since one of the endpoints (The WSHttp one) uses certificate authentication, the server will not go up if this certificate is not defined. So the error is not related to the BasicHttp. That still does not explain why everything works if on the same machine, check if the exact same configuration is used.