当前位置: 首页>>代码示例>>C#>>正文


C# ServerManager.Dispose方法代码示例

本文整理汇总了C#中Microsoft.Web.Administration.ServerManager.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# ServerManager.Dispose方法的具体用法?C# ServerManager.Dispose怎么用?C# ServerManager.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Web.Administration.ServerManager的用法示例。


在下文中一共展示了ServerManager.Dispose方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateIISWebSite

        public static void CreateIISWebSite(string siteName, string siteAddress, string physicalPath)
        {
            ServerManager iisManager = new ServerManager();
            Site site = iisManager.Sites[siteName];
            if (site != null)
            {
                iisManager.Sites.Remove(iisManager.Sites[siteName]);
                iisManager.CommitChanges();
            }

            iisManager.Sites.Add(siteName, "http", string.Concat("*:80:", siteAddress), physicalPath);
            iisManager.CommitChanges();
            iisManager.Dispose();
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:14,代码来源:IISManager.cs

示例2: CreateServerManager

        private static ServerManager CreateServerManager(string sitename)
        {
            // 既存のサイトが出来るまで待機というかループ
            var serverManager = new ServerManager();
            var sc = serverManager.Sites[sitename];
            while (sc == null)
            {
                Thread.Sleep(TimeSpan.FromSeconds(100));
                serverManager.Dispose();
                serverManager = new ServerManager();
                sc = serverManager.Sites[sitename];
            }

            return serverManager;
        }
开发者ID:sleepytaka,项目名称:ARRReverseProxy,代码行数:15,代码来源:Program.cs

示例3: DeleteIISApplication

        /// <summary>
        /// Deletes the IIS application.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        public static void DeleteIISApplication(string applicationName)
        {
            using (ServerManager serverManager = new ServerManager())
            {
                var defaultSite = serverManager.Sites[TestConfig.DefaultWebsiteName];
                Application newApplication = defaultSite.Applications["/{0}".FormatWith(applicationName)];

                // Remove
                if (newApplication != null)
                {
                    defaultSite.Applications.Remove(newApplication);
                    serverManager.CommitChanges();
                }

                serverManager.Dispose();
            }
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:21,代码来源:IISManager.cs

示例4: CreateIISApplication

        public static void CreateIISApplication(string appName, string physicalPath, string appPool)
        {
            ServerManager iisManager = new ServerManager();
            Site defaultSite = iisManager.Sites["Default Web Site"];
            Microsoft.Web.Administration.Application app = defaultSite.Applications[String.Format("/{0}", appName)];

            //Remove application if it already exists
            if (app != null)
            {
                defaultSite.Applications.Remove(app);
                iisManager.CommitChanges();
            }

            defaultSite.Applications.Add(String.Format("/{0}", appName), physicalPath);
            SetApplicationPool(appName, appPool);
            iisManager.CommitChanges();
            iisManager.Dispose();
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:18,代码来源:IISManager.cs

示例5: CreateIISApplication

        /// <summary>
        /// Creates the IIS application.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="physicalPath">The physical path.</param>
        public static void CreateIISApplication(string applicationName, string physicalPath)
        {
            using (ServerManager serverManager = new ServerManager())
            {
                var defaultSite = serverManager.Sites[TestConfig.DefaultWebsiteName];
                Application newApplication = defaultSite.Applications["/{0}".FormatWith(applicationName)];

                // Remove if exists?!
                if (newApplication != null)
                {
                    defaultSite.Applications.Remove(newApplication);
                    serverManager.CommitChanges();
                }

                defaultSite = serverManager.Sites[TestConfig.DefaultWebsiteName];
                newApplication = defaultSite.Applications.Add("/{0}".FormatWith(applicationName), physicalPath);

                newApplication.ApplicationPoolName = TestConfig.TestApplicationPool;

                serverManager.CommitChanges();
                serverManager.Dispose();
            }
        }
开发者ID:vzrus,项目名称:VZF,代码行数:28,代码来源:IISManager.cs

示例6: SetApplicationPool

        public static void SetApplicationPool(string appName, string appPool)
        {
            ServerManager iisManager = new ServerManager();
            Site defaultSite = iisManager.Sites["Default Web Site"];
            Microsoft.Web.Administration.Application app = defaultSite.Applications[String.Format("/{0}", appName)];

            if (app != null)
            {
                app.ApplicationPoolName = appPool;
                iisManager.CommitChanges();
                iisManager.Dispose();
            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:13,代码来源:IISManager.cs

示例7: DoesExistAppPool

        /// <summary>
        /// 应用程序池是否存在
        /// </summary>
        /// <param name="appPoolName"></param>
        /// <returns></returns>
        public static bool DoesExistAppPool(string appPoolName)
        {
            ServerManager manager = new ServerManager();

            ApplicationPool pool;

            pool = null;
            try
            {
                pool = manager.ApplicationPools[appPoolName];
            }
            catch
            {
            }
            manager.Dispose();
            return pool != null;
        }
开发者ID:jessiechenjz,项目名称:IISManager-ServerManage,代码行数:22,代码来源:IISUtil.cs


注:本文中的Microsoft.Web.Administration.ServerManager.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。