问题
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?
回答1:
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.
回答2:
I have found out the reason for this behavior was a faulty ASP.NET 4 installation which i had to reenabled. After that it "just worked".
http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx
来源:https://stackoverflow.com/questions/11502165/basichttpbinding-with-transportwithmessagecredential-and-clientcredentialtype-w