点击这里给我发消息 点击这里给我发消息
首页 > 行业资讯 > Windows>详细内容

创建IIS6应用程序池(C#)

添加时间:2010-6-22
    相关阅读: 程序 C# VC
/// <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;
  }
 } 本文作者:
咨询热线:020-85648757 85648755 85648616 0755-27912581 客服:020-85648756 0755-27912581 业务传真:020-32579052
广州市网景网络科技有限公司 Copyright◎2003-2008 Veelink.com. All Rights Reserved.
广州商务地址:广东省广州市黄埔大道中203号(海景园区)海景花园C栋501室
= 深圳商务地址:深圳市宝源路华丰宝源大厦606
研发中心:广东广州市天河软件园海景园区 粤ICP备05103322号 工商注册