I have a program that I used in Windows Server 2003 that sets up a site in IIS6 that I used without any problems in the past.
I am trying to do the same with Windows 2008 Server Web SP2 and I am getting an error. I assume this is due to the security of the user account. If this is correct, is there a way I can get around this? Thank.
System.Runtime.InteropServices.COMException (0x80070005):
Access is denied. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
Edit:
I found that Microsoft provides an assembly Microsoft.Web.Administrationto simplify my task using IIS7. However, I get an error when starting the application. The error reported says:
"The specified HTTPS binding is invalid."
I do not specify an https binding, although I am not sure why I am getting an error. Here is the code.
using Microsoft.Web.Administration;
....
using (ServerManager iisManager = new ServerManager())
{
iisManager.Sites.Add(site.Name.ToString(), "http", "*:80:" + domain,
server.InetPath + site.Name);
iisManager.CommitChanges();
Site newSite = iisManager.Sites[site.Name];
newSite.Applications[0].ApplicationPoolName = "TrialUsers";
iisManager.CommitChanges();
}
In addition, this task should update several servers in the web farm. Does anyone know how to change the code to make this happen?
source
share