我用c#开发了一个Windows服务。生成PDF报告。要生成PDF文件,我使用第三方dll。应用程序在我的Windows XP平台上运行。当我在Windows Server 2008 64位版本中部署服务时,我得到了这个错误:

检索的COM类工厂 带有CLSID的组件 {46521 b1f - 0 a5b - 4871 - a4c2 fd5c9276f4c6} 由于以下错误导致失败: 80040154.

我使用regsvr32命令注册了DLL。我能够在注册表中看到这个CLSID。但问题依然存在。

有什么问题吗?


当前回答

我也遇到过类似的问题。

我需要在64位机器上开发的Web应用程序中使用旧的32位DLL。我将32位DLL注册到windows\sysWOW64文件夹中,使用该文件夹中的regsvr32版本。

对第三方DLL的调用在Visual Studio中的单元测试中正常工作,但在同一台机器上的IIS中托管的Web应用程序中失败,并出现80040154错误。

将应用程序池更改为“启用32位应用程序”解决了该问题。

其他回答

如果您正在运行一个网站,您还可以尝试将应用程序池设置为禁用32位应用程序(在池的高级设置下)。

我没有更改任何编译设置。

只需在AppPool高级设置中设置“启用32位应用程序= True”。

这对我很有效

接受的答案,改变目标平台到x86没有工作在可能的情况下!

当我安装了水晶报告visual studio和水晶报告运行时引擎(64位)在我的情况下工作!

还有人建议,这个问题可以通过安装32位和64位运行时引擎来解决!

你可以试试!

在我个人的情况下,这个问题是固定的搜索类id在Windows的注册表上的开发机器(因为这个问题是抛出在客户端PC)。该操作将被放置到引起问题的COM组件中:我的. net项目中引用的x86库没有为安装程序或更新程序应用程序注册为OCX/COM。

问候

我发现我的问题与DLL的实际注册有关。

First run "Regedit.exe" from a CMD prompt (I raised it's security level to Administrator, "just in case") then search the Registry (by clicking on "Edit/Find" in the RegEdit menu or by pressing Ctrl+F) for the CLSID showing in the error message which you received regarding the COM class factory. My CLSID was 29AB7A12-B531-450E-8F7A-EA94C2F3C05F. When this key is found, select the sub-key "InProcServer2" under that Hive node and ascertain the filename of the problem DLL in the right hand Regedit frame. showing under "Default". If that file resides in "C:\Windows\SysWow64"(such as C:\Windows\SysWow64\Redemption.dll") then it is important that you use the "C:\Windows\SysWow64\RegSvr32.exe" file to register that DLL from the command line and NOT the default "C:\Windows\System32\RegSvr32.exe" file. So I ran a CMD prompt (under Administrative level control (just in case this level is need required) and type on the command line (in the case of my DLL): C:\Windows\SysWow64\RegSvr32.exe c:\Windows\SysWow64\Redemption.dll the press enter. Close the command window (via "Exit" then Restart your computer (always use restart instead of Close Down then start up, since (strangely) Restart perform a thorough shut down and reload of everything whereas "Shut Down" and Power-Up reloads a stored cache of drivers and other values (which may be faulty). Whenever you register a DLL in the future, remember to use the SysWow64 "RegSvr32.exe" for any DLL stored in the C:\Windows\SysWow64 folder and this problem c(if it is caused by incorrect registration) should not happen again.