C#操作IIS创建应用程序池出现异常:无效索引(Exception from HRESULT:0x80070585)
2013-05-02 16:42
609 查看
在使用C#操作IIS创建应用程序池出现异常:无效索引(Exception from HRESULT:0x80070585)
相关代码:
将相关代码注释以后,未见对Web应用程序带来任何影响。
相关代码:
public static string CreateAppPool(string appPoolName, string frameworkVersion, string managedPipelineMode) { DirectoryEntry rootfolder = new DirectoryEntry("IIS://localhost/W3SVC/APPPOOLS"); try { DirectoryEntry appPool = rootfolder.Children.Add(appPoolName, "IIsApplicationPool"); if (appPool.Properties.Contains("AppPoolCommand")) { appPool.Properties["AppPoolCommand"][0] = "1"; } if (appPool.Properties.Contains("ManagedRuntimeVersion")) { appPool.Properties["ManagedRuntimeVersion"][0] = "v4.0"; } //以下代码在WindowsServer2008版本为6.0的系统上会出现异常: //无效索引(Exception from HRESULT:0x80070585) //if (appPool.Properties.Contains("AppPoolIdentityType")) //{ // appPool.Properties["AppPoolIdentityType"][0] = "4"; //} if (appPool.Properties.Contains("Enable32BitAppOnWin64")) { appPool.Properties["Enable32BitAppOnWin64"][0] = true; } appPool.CommitChanges(); return null; } catch (System.Exception ex) { LogToFile.Save(ex, "CreateAppPool"); return ex.Message; } }
将相关代码注释以后,未见对Web应用程序带来任何影响。
相关文章推荐
- C#:操作 Excel 异常:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
- C#:操作 Excel 异常:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
- System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E
- Exce报表生成时出现“Workbook Add(System.Object) Message:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_
- solr创建索引时出现的异常org.apache.solr.common.SolrException: Exception writing document id xx to the index;
- 格式太旧或是类型库无效。 (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT))
- C# 调用Excel 出现服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)
- 创建silverlight应用程序 出现 没有注册类别(异常来自 HRESULT:0X80040154 (REGDB_E_CLASSNOTREG))
- 数据导到excel时出现Exception from HRESULT: 0x800A03EC的异常
- win2008server R2 x64 部署.net core到IIS上出现【Failed to load the dll from [C:\Program Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057】错误
- 线程中设置窗体控件的值出现异常(线程间操作无效: 从不是创建控件“textBox1”的线程访问它)
- 数据导到excel时出现Exception from HRESULT: 0x800A03EC的异常
- IIS 异常 “System.OutOfMemoryException”、“存储空间不足,无法完成此操作。”
- C#线程间操作无效: 从不是创建控件" XX" 的线程访问它
- SQL SERVER 2005 流览多维数据集时出现没有注册类别(异常来自:HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))的错误
- -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.【创建键盘监听事件,然后操作键盘(弹出、收回),结果在运行程序时出现如下错误(如有知道解决办法的朋友请留言探讨!)】
- 操作IIS的应用程序池与站点分配(C#)
- 【转】C#线程间操作无效: 从不是创建控件" XX" 的线程访问它
- c#线程问题:线程间操作无效:从不是创建控件 的线程访问它InvalidOperationException异常
- 检索 COM 类工厂中 CLSID 为 {28E68F9A-8D75-11D1-8DC3-3C302A000000} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))