We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Value does not fall within the expected range during ssl binding.RSS

2 replies

Last post Feb 12, 2013 05:26 PM by jnukv

  • Value does not fall within the expected range during ssl binding.

    Feb 04, 2013 05:49 PM|jnukv|LINK

    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();

  • Re: Value does not fall within the expected range during ssl binding.

    Feb 06, 2013 08:02 AM|dino Grievous|LINK

    HI

    Although I'm not sure about which line is your line 102.

    Here I provide a scnario may resolve your problem which I found from here:

    http://forums.iis.net/t/1167734.aspx/1

    byte[] certificateHash = Encoding.ASCII.GetBytes(lcertificateHash);

    You can try it, and debug your project.

    Please Mark As Answer If it Helps

    Dino
  • Re: Value does not fall within the expected range during ssl binding.

    Feb 12, 2013 05:26 PM|jnukv|LINK

    Hi Dino,

     

    Thanks for your answer, The problem in the post that you mention is that the link inside withg the answer don't work.

    I post for the right link there.

     

    Thanks,

    Hai