异常是 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))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;
}
}
{
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;
}
}
解决方案 »
- char nchar nvachar ntext的区别
- 超级简单的系统流程问题!!!
- ★Gridview 中动态生成模板列后怎么绑定值,Xpath后台绑定方式
- 急急急!!!!!
- 【两个repeater嵌套,其中linkbutton怎样激发事件】
- 文件上传相关
- 处理ntext字段的问题,调试不成功,请高手帮忙
- 未将对象引用设置到对象的实例
- asp.net中如何将byte[]二进制保存在cookie中
- 两个不同的数据源,相通的数据结构,如何用Dataset保持数据统一呢?
- visual studio ,可以取代dreamweaver吗?在vs 中也可以做网页吧?
- 网站数据库设计问题,产品表通用设计。。。。。。比较难
手工创建看看不同
检查权限IIS完整解析