3

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?

2 Answers2

4

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.

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
Anand
  • 14,545
  • 8
  • 32
  • 44
  • I have activated Windows Auth in IIS already. I can't even add the Service Reference to the WCF service configured like this. –  Jul 16 '12 at 11:19
  • You would not be able to add service reference if you configure your we service to use BasicHttpBinding because by using this binding, you are actually not using SOAP. For Non Soap Based service, you can not generate meta data – Anand Jul 16 '12 at 11:22
  • see this http://stackoverflow.com/questions/11390594/failed-to-add-a-service-service-metadata-may-not-be-accessible-make-sure-your/11392842#11392842 – Anand Jul 16 '12 at 11:23
  • I have added dozens of service references using BasicHttpBinding, i really cant see the problem here. –  Jul 16 '12 at 11:44
  • Maybe, you was not authenticated, if you couldn't add service by using "Add service reference"? Have you added certificates for server and client? – Sir Hally Jul 17 '12 at 10:53
0

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