I need to programatically add an IIS 7.x site and I got stuck when this should be created with a HTTPS/SSL binding by default, usig SiteCollection.Add(string, string, string, byte[]) overload.
Giving https:*:80:test.localhosthttps:*:443:test.localhost as bindingInformation throws an ArgumentException with this message: The specified HTTPS binding is invalid.
What’s wrong in this binding information?
Thank you.
EDIT: I’m using Microsoft.Web.Administration assembly.
Here is what I did to create https site and it worked. I skip some parts of code here, of course.
UPD: the certificate is created from a pfx file the following way: