[ACCEPTED]-Enable SSL for my WCF service-ssl

Accepted answer
Score: 45

This page on MSDN explains WCF Binding Security.

http://msdn.microsoft.com/en-us/library/ms729700.aspx

The 21 BasicHttpBinding class is primarily used 20 to interoperate with existing Web services, and 19 many of those services are hosted by 18 Internet Information Services (IIS). Consequently, the 17 transport security for this binding is 16 designed for seamless interoperation 15 with IIS sites. This is done by setting 14 the security mode to Transport and then 13 setting the client credential type. The 12 credential type values correspond to 11 IIS directory security mechanisms. The 10 following code shows the mode being set 9 and the credential type set to Windows. You 8 can use this configuration when both 7 client and server are on the same Windows 6 domain.

C#

BasicHttpBinding b = new BasicHttpBinding();
b.Security.Mode = BasicHttpSecurityMode.Transport ;
b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

Or, in configuration:

<bindings>   
   <basicHttpBinding>
            <binding name="SecurityByTransport">
               <security mode="Transport">
                 <transport clientCredentialType="Windows" />
                </security>
            </binding>   
   </basicHttpBinding> 
</bindings>

To enable 5 ssl, without a login, set clientCredentialType 4 to "None".

Options for security 3 mode are:

None, Transport, Message, TransportWithMessageCredential 2 and TransportCredentialOnly

You can find 1 more details at: http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpsecuritymode.aspx

Score: 1

I just faced the same problem and found 6 this MSDN article: How to: Configure an IIS-hosted WCF service with SSL At the end of the article 5 you will find the xml configuration of the 4 WebConfig file.

The solution worked just 3 fine for me. One more thing to say, keep 2 in mind that you need a REAL certificate 1 for your release!

Score: 0

I think that if under your bindings where you have 6 the <Security mode="Transport">, if you would change it to be <security mode="None">, you 5 would be ok.

This is a copy of a code base that I'm 4 working on and I tried that in-code, and 3 it appears to be working.
I get the WSDL 2 at least when I call the service, if that 1 helps at all.

BasicHttpBinding basicBinding = new BasicHttpBinding();
if (RegistryConnectionStringFactory.UseSslForCommunications)
{
   basicBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
   basicBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
}
else
{
   basicBinding.Security.Mode = BasicHttpSecurityMode.None;
   basicBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
}

More Related questions