On a Windows 2012 server we create websites using C# code. This also applies the https binding w/ SSL.
For some reason whenever a new site is created it sets all sites' SSL cert to "Not Selected" Is there way to prevent this?
Code we use
//get the server manager instance
using (ServerManager mgr = new ServerManager())
{
SiteCollection sites = mgr.Sites;
Site site = mgr.Sites[siteName];
if (site != null)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.WorkingDirectory = @"C:\Windows\System32\Inetsrv";
startInfo.FileName = "appcmd.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = string.Format("set site /site.name:\"{0}\" /+bindings.[protocol='https',bindingInformation='{1}:443:{2}']", siteName, ipAddress, hostHeader);
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
return true;
}
}
else
throw new Exception("Site: " + siteName + " does not exist.");
}