I use Microsoft.Web.Administration(inside Wix CustomAction) to configure the server name and bind to an existing server certificate on the IIS 8.5 site.
Turns off, SNI installation unbinds the certificate. The following code will simplify the situation:
using Microsoft.Web.Administration;
var binding = site.Bindings.FirstOrDefault(x => x.IsIPPortHostBinding && x.Host == sitename);
binding.CertificateHash = certificate.GetCertHash();
binding.CertificateStoreName = store.Name;
binding["sslFlags"] = 1;
Results:
FROM binding["sslFlags"] = 1;

Without binding["sslFlags"] = 1;

Is this a mistake or am I missing something? How can I bind both SNI and certificate?
source
share