c# - Setting Server Name Indication (SNI) takes off certificate binding -


i'm using microsoft.web.administration (inside wix customaction) configure server name indication , bind existing server certificate on iis 8.5 site.

turns out, setting sni takes off certificate binding. following code make things clearer:

using microsoft.web.administration;  var binding = site.bindings.firstordefault(x => x.isipporthostbinding && x.host == sitename);  binding.certificatehash = certificate.getcerthash(); binding.certificatestorename = store.name;  // statement causing certificate info messed up. binding["sslflags"] = 1; // or binding.setattributevalue("sslflags", 1); 

results:

with binding["sslflags"] = 1; enter image description here

without binding["sslflags"] = 1; enter image description here

is bug or missing something? how can both sni , certificate binding stick?

it seems microsoft.web.administration v7.0 culprit here. official 1 on nuget gallery , seems meant iis 7 (i mean it'll work features common in both iis 7 & 8 7 doesn't have have weird results above).

using iis.microsoft.web.adminstration (which seems community uploaded package iis 8.5) works. got hint answer.

updated code:

binding.certificatehash = certificate.getcerthash(); binding.certificatestorename = store.name;  binding.sslflags = sslflags.sni;  // <<< notice has helpful enums 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -