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

  • Question

  • User501135855 posted


    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 ?



    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";



    Monday, February 4, 2013 5:49 PM

All replies

  • User1197681979 posted


    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:


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

    You can try it, and debug your project.

    Wednesday, February 6, 2013 8:02 AM
  • User501135855 posted

    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.




    Tuesday, February 12, 2013 5:26 PM