Add application pool to the website

 

            DirectoryEntry _RootFolder = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
            DirectoryEntry _VirDir = _RootFolder.Children.Add(@"OKWeb", "IIsWebVirtualDir");
            _VirDir.Properties["Path"].Value = @"C:\test"; //设置路径
            _VirDir.Invoke("AppCreate", true);
            //设置名称
            _VirDir.Properties["AppFriendlyName"].Value = "OkWeb";
            _VirDir.Properties["AppIsolated"].Value = 2;
            _VirDir.CommitChanges();
            _RootFolder.CommitChanges();

 

 

posted @ 2010-07-28 19:03  greencolor  阅读(150)  评论(0编辑  收藏  举报