本文整理汇总了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();
}
示例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;
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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;
}