检索具有CLSID..Error的组件的COM类工厂 [英] Retrieving the COM class factory for component with CLSID..Error
问题描述
protected void btnRecycle_Click(object sender, EventArgs e)
{
ServerManager mgr = new ServerManager();
System.Collections.IEnumerator ie = mgr.ApplicationPools.GetEnumerator();
while (ie.MoveNext())
{
ddlApplicationPool.Items.Add(((Microsoft.Web.Administration.ApplicationPool)(ie.Current)).Name);
}
}
错误:
为CLSID为{2B72133B-3F5B-4602-8952-803546CE3344}的组件检索COM类工厂因以下错误而失败:80040154未注册类(HRESULT的异常:0x80040154(REGDB_E_CLASSNOTREG)).
Retrieving the COM class factory for component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
推荐答案
如果Windows中未安装IIS,则会引发此异常.您可以将该异常用作依赖项检查器.
This exception gets thrown if IIS is not installed in Windows. You can use that exception as a dependency checker.
要安装IIS,请执行以下操作:
To install IIS, do the following:
Windows开始"菜单>控制面板">程序和功能">打开或关闭Windows功能">检查"Internet信息服务"树中的顶部节点
Windows Start Menu > Control Panel > Programs and Features > Turn Windows Features on or off > check the top node in the "Internet Information Services" tree
一个更好的方法就是以这种方式检查服务.
A better way is just to check for the service this way.
System.ServiceProcess.ServiceController sc1 = new System.ServiceProcess.ServiceController("World Wide Web Publishing Service");
这篇关于检索具有CLSID..Error的组件的COM类工厂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!