Hello
I'm trying to add a SSL certificate to a site from c#, but I can't get it to work. It keep throw "Value does not fall within the expected range."
The certificate is a self-signed.
My code:
using (ServerManager manager = new ServerManager())
{
Site site = manager.Sites["mysite"];
if (site != null)
{
byte[] certificateHash = Encoding.ASCII.GetBytes("672edf12189159aa486805ef0e42ce21");
Binding binding = site.Bindings.CreateElement();
binding.Protocol = "https";
binding.CertificateHash = certificateHash;
binding.CertificateStoreName = "*.myssl";
binding.BindingInformation = "*:443:mysite";
site.Bindings.Add(binding);
manager.CommitChanges();
}
}
Any idea what I doing wrong?
Thanks,
Michael Petersen