/// <summary>
/// 创建应用程序池
/// </summary>
/// <param name="metabasePath">连接字符串[IIS://localhost/W3SVC/AppPools]</param>
/// <param name="appPoolName">程序池名称</param>
/// <param name="Username">用户名</param>
/// <param name="Password">密码</param>
static public bool CreateAppPool(string metabasePath, string appPoolName,string Username,string Password)
{
try
{
if (metabasePath.EndsWith("/W3SVC/AppPools"))
{
DirectoryEntry newpool;
DirectoryEntry apppools = new DirectoryEntry(metabasePath);
newpool = apppools.Children.Add(appPoolName, "IIsApplicationPool");
newpool.Properties["WAMUserName"][0] = Username;
newpool.Properties["WAMUserPass"][0] = Password;
newpool.Properties["AppPoolIdentityType"][0] = "3";
newpool.CommitChanges();
return true;
}
else
{
return false;
}
}
catch// (Exception ex)
{
return false;
}
}
创建IIS6应用程序池(C#)
最新推荐文章于 2020-11-10 09:18:57 发布