c# - Microsoft.Web.Administration: Value does not fall within the expected range -


when adding binding iis using microsoft.web.administration code this:

var newbinding = site.bindings.createelement(); newbinding.bindinginformation = bindinginformation; var existingssl = // code finds existing ssl binding copy off var sslflags = sslflags.sni; if (existingssl != null) {     newbinding.protocol = existingssl.protocol;     newbinding.certificatehash = existingssl.certificatehash;     newbinding.certificatestorename = existingssl.certificatestorename; }  site.bindings.add(newbinding.bindinginformation, newbinding.certificatehash, newbinding.certificatestorename, sslflags); 

i exception

system.argumentexception: value not fall within expected range.    @ microsoft.web.administration.interop.iapphostmethodinstance.execute()    @ microsoft.web.administration.configurationmethodinstance.execute()    @ microsoft.web.administration.binding.addsslcertificate(byte[] certificatehash, string certificatestorename)    @ microsoft.web.administration.bindingmanager.bindingtransaction.commit()    @ microsoft.web.administration.bindingmanager.save()    @ microsoft.web.administration.servermanager.commitchanges() 

the bindinginformation value failing of format *:443: - meaning there no host header information.

in case, sni flag illegal flag. sni can used when hostheader specified.

the trick discovering (rather obvious in hindsight) error try , mirror settings being applied in ui. ui has validation helps show illegal thing attempting.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -