C# “80040154 类未注册”与来自 ASP.NET 的互操作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9502040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'80040154 Class not registered' with interop from ASP.NET
提问by Lawrence Wagerfield
I'm receiving the following error on a Windows XP Pro SP2 x64 machine running IIS6:
我在运行 IIS6 的 Windows XP Pro SP2 x64 机器上收到以下错误:
System.Runtime.InteropServices.COMException:
Retrieving the COM class factory for component with CLSID
{3C250CBD-6CC9-11D2-9457-00004B48467E} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
This occurs when trying to instantiate a COM interop object.
尝试实例化 COM 互操作对象时会发生这种情况。
Oddly enough, this works fine from a console application running under the same account as the application pool (a user in AD). I.e. both use UserX, so it doesn't seem like an obvious permissions issue.
奇怪的是,这在与应用程序池(AD 中的用户)在同一帐户下运行的控制台应用程序中运行良好。即两者都使用 UserX,所以这似乎不是一个明显的权限问题。
Anyone else had anything similar?
其他人有类似的吗?
采纳答案by user1234883
Make sure that your application pool is either 32 bit (or supports 32 bit apps) or your COM control supports 64 bit apps. Most likely, your native COM library is 32bit and your pool runs a 64 bit worker by default, which is unable to load 32bit COM dll.
确保您的应用程序池是 32 位(或支持 32 位应用程序)或您的 COM 控件支持 64 位应用程序。最有可能的是,您的本机 COM 库是 32 位,并且您的池默认运行 64 位工作程序,无法加载 32 位 COM dll。
回答by DRapp
if running under IIS, is it really using "UserX", or is it using "Guest", "ASP.NET", or "IWAM_USER" or similar other account. Also, if its being invoked from IIS, you might need to check permissions... not just at the file level, but at the machine's COM configuration level.
如果在 IIS 下运行,它是真的使用“UserX”,还是使用“Guest”、“ASP.NET”或“IWAM_USER”或类似的其他帐户。此外,如果它是从 IIS 调用的,您可能需要检查权限……不仅在文件级别,而且在机器的 COM 配置级别。
Last time I had to deal with this, I would do
上次我不得不处理这个时,我会这样做
START -> RUN -> DCOMCNFG
开始 -> 运行 -> DCOMCNFG
or just bring up component services.
或者只是调出组件服务。
Then expand Component Services -> Computers -> My Computer -> DCOM Config and then scroll down to the COM object you are trying to use. Right click on it and there are multiple abs... Identity is the one that it will be launched as.. you can override this to put in a specific user to "bypass" the assumed "default". For TESTING ONLY, I would set it up with a less restrictive account (power user, not necessarily an admin, but try that last), and see if that helps.
然后展开组件服务 -> 计算机 -> 我的电脑 -> DCOM 配置,然后向下滚动到您尝试使用的 COM 对象。右键单击它,有多个 abs... Identity 是它将被启动的那个...您可以覆盖它以放置特定用户以“绕过”假定的“默认”。仅用于测试,我会使用限制较少的帐户(高级用户,不一定是管理员,但最后尝试)设置它,看看是否有帮助。
In addition, on the Security tab, there are options for who can Launch/Activate and who can "Access" it. you might need to make sure your account is valid within that.
此外,在安全选项卡上,还有谁可以启动/激活以及谁可以“访问”它的选项。您可能需要确保您的帐户在此范围内有效。

