Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've found through APPCMD that most of IIS7 configuration is possible through the command line. One thing I've not figured out how to do yet: in IIS Manager, Bindings -> Edit -> pick an SSL Certificate.

"appcmd set site /site.name:foo /?" lists 2 keys that start with "bindings" ("protocol", "bindingInformation") but I haven't found out what they are.

Some other place suggested that "netsh" could do this, but "netsh http show sslcert" shows my certificate as bound to "" and not to particular IIS7 sites.

Given that I know the IIS7 name/ID of a site, and the hash of my certificate (which is already the cert on other sites here), is there any way to make it the SSL cert for another IIS7 site, from the command line?

UPDATE: I did this in the UI, and diff'd the registry, and see that HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\SslBindingInfo\ (also in ControlSet0001) is created with my SslCertHash, and an AppId that looks just like the UUID that "netsh http show sslcert" prints but with each section reversed (81e1c34d4be121...). I think I read that this is the AppId for IIS apps, but I'm not sure. It doesn't change in the registry when I delete the Site in IIS Manager and switch to another Site with this SSL cert. Anyway, this looks like the same level of granularity that netsh provides, so I really don't know where IIS Manager gets its per-Site bindings SSL cert assignment.

share|improve this question
add comment

1 Answer

To call out the bits, this is different from IIS6 and earlier. In IIS 6, the metabase contained the socket, the certificate hash associated with the socket, and so on. In 7, the IIS config just contains a socket (a.b.c.d:443) and lets the OS worry about the certificate management stuff on that socket. (Through the GUI, it's designed to look roughly how it used to). The rule is: you can only have one certificate bound to one socket.


In IIS 7, IIS doesn't actually care about the certificate binding. I know, like, gasp, right?

In IIS7, all the IIS configuration does is tie IIS to a specific socket (IP + port). That's it. Makes the configuration much more portable between boxes when you don't need to uniquify the certificate hash on each one.

IIS config is managed using APPCMD or {insert IIS 7 management tool of choice here}, by creating a binding for the site to a socket.


The OS layer takes over control of the SSL part, so you use NETSH to associate a certificate with a particular socket.

This is done through NETSH.

Sukesh posted a guide to both bits a long time ago, and it's still valid: http://stackoverflow.com/questions/591597/how-to-assign-a-ssl-certificate-to-iis7-site-from-command-prompt

share|improve this answer
I saw that SO Q and the Sukesh guide in my searching, but I can't get it to work, and don't understand how it would. I get why IIS7 (I don't know anything about IIS6) would do certs in the OS and not in IIS, but IIS Manager (the GUI) lets me set certs per "SITE", and new sites created by Sukesh's method don't have any cert set (and hence just give an error). I've got other (stopped) sites in IIS also on port 443 that have a cert -- where is the site-cert association stored? –  Ken Apr 11 '11 at 17:29
The site isn't bound to a cert, it's bound to HTTPS on a particular socket. The cert used by that socket is a detail managed by HTTP.SYS, via NETSH. So something like appcmd set site "My Own Web Site" /-bindings.[protocol='https',bindingInformation=''] assuming you've already bound the certificate to that IP:port with NetSH. The netsh command corresponding with that would be netsh add sslcert ipport= certstorename=my blah blah etc. Make sense? –  TristanK Apr 12 '11 at 7:47
TristanK: It makes perfect sense that it should work that way, but I don't understand why IIS Manager lets you edit SSL certificates at the Site level then. Is that part of the IIS UI just completely misleading? Does editing the SSL cert in IIS change it for all websites on that port? (I was sure I'd seen it not do that, but today it seems to, and I'm all confused.) –  Ken Apr 12 '11 at 17:12
Yes, you cannot have multiple certificates bound to a single port. Just can't. So from that perspective, the UI lets you do something more convenient than juggle a list of IPs and certificates, as long as you keep that in mind. –  TristanK Apr 12 '11 at 22:56
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.