BasicHttpBinding with TransportWithMessageCredential and clientCredentialType="Windows"

UrbanEsc picture UrbanEsc · Jul 16, 2012 · Viewed 9k times · Source

I am using this binding configuration on client and server:

<basicHttpBinding>
    <binding name="BasicHttpBinding_IService1">
        <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Windows" />
        </security>
    </binding>
</basicHttpBinding>

The client credentials seem to not be passed automagically (or are they?) this way like i assumed, so i need to know how to set them by myself. Will this even work?

Answer

Anand picture Anand · Jul 16, 2012

You have to enable Windows Authentication on IIS. Look at the below link for how to do it.

Also, I checked the MSDN web site, the key difference between your config and at msdn is security mode

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpEndpointBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

The only difference is mode as you can see. I am not sure this would solve your problem but give it a go.

Below are the 5 possible “Security Modes” across all “Service Bindings”.

None - Turns security off.

Transport - Uses “Transport security” for mutual authentication and message protection.

Message - Uses “Message security” for mutual authentication and message protection.

Both - Allows you to supply settings for transport and message-level security (only MSMQ supports this).

TransportWithMessageCredential - Credentials are passed with the message and message protection and server authentication are provided by the transport layer.

TransportCredentialOnly - Client credentials are passed with the transport layer and no message protection is applied.