我正在尝试在 IIS 5.1 上添加网站
当我尝试使用下面的函数为我的新网站创建应用程序池时,我遇到了这个奇怪的错误“system.directoryNotFound Exception ... in CreateAppPool”
最奇怪的是,应用程序池的创建功能在带有 IIS7 的 Windows 7 电脑上完美运行,但在带有 ISS5.1 的 Windows XP 上却不起作用 下面的路径“IIS://localhost/W3SVC/AppPools”在IIS5.1上有什么不同吗?
public static CreateAppPool(string name)
{
string machineName = System.Environment.GetEnvironmentVariable("COMPUTERNAME");
DirectoryEntry Service = new DirectoryEntry("IIS://"+machineName+"/W3SVC/AppPools");
// create new app pool
DirectoryEntry appPool = Service.Children.Add(name, "IIsApplicationPool");
appPool.CommitChanges();
Service.CommitChanges();
}
最佳答案
您无法在 IIS 5 中创建应用程序池,但您可以在默认网站下创建一个新的虚拟目录并将其设为应用程序。
关于c# - 如何在c#代码中在iis 5.1中添加新的应用程序池?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14237693/