I have an Azure cloud service, which runs as a website engine and loads a slightly different site depending on which domain name you use.
I'm working through using centralized certificates and assigning an SSL binding dynamically at the application start. I apply the changes, everything looks correct, but the 443 bindings do not respond. IIS doesn't seem to realise that it has bindings there.
However, when I remote onto the server and I edit an existing binding, add a character onto the host name and then delete it again (basically just to make the OK button appear), press OK and it works! Nothing changed in the bindings.
So what is that additional step that occurs when a user press OK after creating a new binding?
I've tried looking at the EnabledProtocols, but that doesn't help and I can't see anything else that might be causing the problem.
For reference, this is my basic code:
using (ServerManager manager = new ServerManager())
{ Site website = manager.Sites.FirstOrDefault(); if (website != null) { foreach (var domain in domainNames) { var newBinding = string.Format("{0}:{1}:{2}", "*", "443", domain); // if the binding does not exist, add it in if (!website.Bindings.Any(x => x.Protocol == protocol && x.BindingInformation.Equals(newBinding, StringComparison.CurrentCultureIgnoreCase))) { BindingCollection bindingCollection = website.Bindings; Binding binding = website.Bindings.CreateElement("binding"); binding["protocol"] = protocol; binding["bindingInformation"] = newBinding; // A value of "3" specifies that the secure connection be made using the centralized SSL certificate store // while requiring Server Name Indicator binding["sslFlags"] = 3; bindingCollection.Add(binding); changesMade = true; } } if (changesMade) { manager.CommitChanges(); } } }