User501135855 posted
Hello,
I run the attached code and get this error message:
{"Value does not fall within the expected range."}
I know that the certificationHash is the problem but i'm using a valid one (I know it because from the iismanager i can set this certification).
What i'm doing worng ?
Thanks,
Hai
the stack trace:
at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute() at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute() at Microsoft.Web.Administration.Binding.AddSslCertificate(Byte[]
certificateHash, String certificateStoreName) at Microsoft.Web.Administration.BindingManager.BindingTransaction.Commit() at Microsoft.Web.Administration.BindingManager.Save() at Microsoft.Web.Administration.ServerManager.CommitChanges()
at PmIISAgent.PmIIS.AddWithCertificate(String name, String bindingInformation, String physicalPath, String certificateHash, String bindingProtocol, Boolean ServerAutoStart, String appPoolName) in D:\ProductionMap\PMAgent\DedicatedAgents\trunk\haiAgents\pmIISAgent\pmIISAgent\pmIISAgent\pmIISAgent.cs:line
102
my code:
site = serverManager.Sites[name];
BindingCollection
bindingCollection = site.Bindings;
Binding binding = site.Bindings.CreateElement("binding"); binding["protocol"] = bindingProtocol; binding["bindingInformation"]
= bindingInformation;
binding.CertificateHash = lcertificateHash.ToArray<byte>();
// valid certification ="e19f241143b94c92eb85d3f4e72aba3b6d60603b";//certificateHash;
binding["certificateStoreName"] = "MY";
bindingCollection.Add(binding);
serverManager.CommitChanges();