예제 #1
0
        public int CreateNewWebSite(NewWebSiteInfo siteInfo, int newSiteNum)
        {
            DirectoryEntry rootEntry    = GetDirectoryEntry("");
            DirectoryEntry newSiteEntry = rootEntry.Children.Add(newSiteNum.ToString(), "IIsWebServer");

            newSiteEntry.CommitChanges();

            newSiteEntry.Properties[WebSiteParameter.ServerBindings.ToString()].Value           = siteInfo.Bindings;
            newSiteEntry.Properties[WebSiteParameter.ServerComment.ToString()].Value            = siteInfo.SiteName;
            newSiteEntry.Properties[WebSiteParameter.AccessFlags.ToString()].Value              = 512 | 1;
            newSiteEntry.Properties[WebSiteParameter.AnonymousUserName.ToString()].Value        = siteInfo.AccessUser.IdentityString;
            newSiteEntry.Properties[WebSiteParameter.AnonymousUserPass.ToString()].Value        = siteInfo.AccessUser.PasswordCode;
            newSiteEntry.Properties[WebSiteParameter.ScriptMaps.ToString()].Value               = siteInfo.ScriptMaps;
            newSiteEntry.Properties[WebSiteParameter.LogFileLocaltimeRollover.ToString()].Value = siteInfo.LogFileLocaltimeRollover.ToString();
            newSiteEntry.Properties[WebSiteParameter.LogFileDirectory.ToString()].Value         = siteInfo.LogFileDirectory;
            newSiteEntry.CommitChanges();

            DirectoryEntry vdEntry = newSiteEntry.Children.Add("root", "IIsWebVirtualDir");

            vdEntry.CommitChanges();

            //创建应用程序,并指定应用程序池为"HostPool","true"表示如果HostPool不存在,则自动创建
            vdEntry.Invoke("AppCreate3", new object[] { 2, siteInfo.AppPoolName, true });
            vdEntry.Properties[WebVirtualDirParameter.Path.ToString()].Value = siteInfo.DirectoryPath;
            //设置应用程序名称
            vdEntry.Properties[WebVirtualDirParameter.AppFriendlyName.ToString()].Value = "v_" + siteInfo.SiteName;
            vdEntry.CommitChanges();
            DisposeDirectoryEntry(rootEntry);
            return(newSiteNum);
        }
예제 #2
0
        public int CreateNewWebSite(NewWebSiteInfo siteInfo, int newSiteNum)
        {
            DirectoryEntry rootEntry = GetDirectoryEntry("");
            DirectoryEntry newSiteEntry = rootEntry.Children.Add(newSiteNum.ToString(), "IIsWebServer");
            newSiteEntry.CommitChanges();

            newSiteEntry.Properties[WebSiteParameter.ServerBindings.ToString()].Value = siteInfo.Bindings;
            newSiteEntry.Properties[WebSiteParameter.ServerComment.ToString()].Value = siteInfo.SiteName;
            newSiteEntry.Properties[WebSiteParameter.AccessFlags.ToString()].Value = 512 | 1;
            newSiteEntry.Properties[WebSiteParameter.AnonymousUserName.ToString()].Value = siteInfo.AccessUser.IdentityString;
            newSiteEntry.Properties[WebSiteParameter.AnonymousUserPass.ToString()].Value = siteInfo.AccessUser.PasswordCode;
            newSiteEntry.Properties[WebSiteParameter.ScriptMaps.ToString()].Value = siteInfo.ScriptMaps;
            newSiteEntry.Properties[WebSiteParameter.LogFileLocaltimeRollover.ToString()].Value = siteInfo.LogFileLocaltimeRollover.ToString();
            newSiteEntry.Properties[WebSiteParameter.LogFileDirectory.ToString()].Value = siteInfo.LogFileDirectory;
            newSiteEntry.CommitChanges();

            DirectoryEntry vdEntry = newSiteEntry.Children.Add("root", "IIsWebVirtualDir");
            vdEntry.CommitChanges();

            //����Ӧ�ó��򣬲�ָ��Ӧ�ó����Ϊ"HostPool","true"��ʾ���HostPool�����ڣ����Զ�����
            vdEntry.Invoke("AppCreate3", new object[] { 2, siteInfo.AppPoolName, true });
            vdEntry.Properties[WebVirtualDirParameter.Path.ToString()].Value = siteInfo.DirectoryPath;
            //����Ӧ�ó�������
            vdEntry.Properties[WebVirtualDirParameter.AppFriendlyName.ToString()].Value = "v_" + siteInfo.SiteName;
            vdEntry.CommitChanges();
            DisposeDirectoryEntry(rootEntry);
            return newSiteNum;
        }
예제 #3
0
 public int CreateNewWebSite(NewWebSiteInfo siteInfo)
 {
     return CreateNewWebSite(siteInfo, MakeupNewWebsiteID());
 }
예제 #4
0
 public int CreateNewWebSite(NewWebSiteInfo siteInfo)
 {
     return(CreateNewWebSite(siteInfo, MakeupNewWebsiteID()));
 }