IIS 7 and Above
UI & Remote Management
Setting SSL Settings with Microsoft.Web.Administration
Last post Nov 18, 2009 01:13 PM by mikesm
Nov 17, 2009 06:06 PM|mikesm|LINK
We have a C# application that is used to remotely manage our web applications. One of its functions is create and populate new virtual directories (Applications in IIS 7) on our web servers. The application was written to work with IIS 6 serveral years
ago. We have now moved to all our systems to IIS 7 (Windows 2008). We want to updated this application to use the Microsoft.Web.Administration namespace classes rather than using the System.DirectoryServices classes that are currently used. This will allow
us to leave the IIS 6 Compatibility components out of new Windows installations.
I had no problems getting the Microsoft.Web.Administration classes to create new applications on our IIS 7 machines, but I can not figure out how to set the SSL setting on an application or for that matter on a web site using these classes. Any idea how
it is done? We run a mix of web applications on a web site so that one application will require SSL and another application on the site will not.
remote Administration issue
Nov 17, 2009 11:05 PM|steve schofield|LINK
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Nov 18, 2009 05:20 AM|CarlosAg|LINK
Depending on which settings you want to enable, enabling SSL you basically have to add a binding, the Site has a Bindings collection which has an overload that receives the certificateHash and the certificateStore, something like:
ServerManager serverManager = new ServerManager();
serverManager.Sites["Default Web Site"].Bindings.Add("*:443:", certificateHash, "My");
You can also just set the CertificateHash property in an existing Binding.
To set the sslFlags you will need to set the system.webServer/security/access section, see:
Nov 18, 2009 01:13 PM|mikesm|LINK
Thanks! The referenced Access Security article was exactly what I was looking for. Now I can set the sslFlags.