The idea here is that for my testing, before I commit to purchasing the SSL certificate, I want to enable the WCF service in non-ssl mode. I've done it in the past using this code, but for the life of me, cannot figure out how to translate it into the web.config file.
If someone can put me in the right direction on how you would go about this translation, that would be much appreciated.
Binding basicBinding = null;
if (RegistryConnectionStringFactory.UseSslForCommunications)
{
basicBinding = new BasicHttpBinding();
(basicBinding as BasicHttpBinding).Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
(basicBinding as BasicHttpBinding).Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
creds.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.MembershipProvider;
creds.UserNameAuthentication.MembershipProvider = Membership.Provider;
}
else
{
HttpTransportBindingElement transport = new HttpTransportBindingElement()
{
AuthenticationScheme = System.Net.AuthenticationSchemes.Basic
};
basicBinding = new CustomBinding(transport);
svcHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new AspNetUsernamePasswordValidator();
svcHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
}