I want to support SNI with SSL certificates(windows10 + IIS:10.0.17) using C#. Binding can be added via:
website.Bindings.Add(szBinding, hashBytes, sslStore);
How do I apply SNI on the new added Binding? The following code has no effect :
website.Bindings[0].SslFlags = SslFlags.Sni;
The question Programmatically add binding on IIS 8 with SNI option addresses the issue, but problem is as I described it earlier, using this flag "SslFlags.Sni" makes no effect i.e. when I check the binding in IIS, SNI Checkbox is still unchecked. Means, setting this flag does not effect on binding in IIS. I am on windows 10 with IIS v.10.0.17.
What am I missing? Any good article/help will be highly appreciated.
There was an issue with the binding value. I was using ip:port:
instead of ip:port:hostname
. Using Binding name with hostname and SNI flag resolved the issue.
This code will add a binding with SNI Enabled:
var szBinding = "IP:PORT:HOSTNAME";
website.Bindings.Add(szBinding, hashBytes, install.SslStore, SslFlags.Sni);