62,272
社区成员
发帖
与我相关
我的任务
分享
public static String CreateNewApplicationPool(string AppPoolName,string Username,string Password)
{
try
{
DirectoryEntry newpool;
string enPath = string.Format("IIS://{0}/W3SVC/AppPools", HostName);
DirectoryEntry apppools = GetDirectoryEntry(enPath);
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";
}
catch(Exception ex)
{
return ex.Message;//false;
throw;
}
}