Class IIS 发布的 WebService 中未注册错误

Class not Registered error in IIS Published WebService

我正在开发一个 WebService,我使用 COM 引用(dll 文件。我在项目中添加了这个引用)。当我通过 VisualStudio 运行 我的网络服务时,一切正常。但是,当我在本地 IIS 中发布网络服务器并尝试执行网络服务时,出现错误:

"System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {80327130-FFDB-4506-B160-B9F8DB32DFB2} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at WebServiceDA.WebService1..ctor()"

我尝试在 SysWOW64 和 System32 文件夹中注册 class,但没有成功。

我的机器是64位的,COM是32位的。但是当我将 Plattform 目标更改为 'X86'(最初是 'Any CPU')时,我得到了错误:

无法加载文件或程序集或其依赖项之一。试图加载格式不正确的程序。

有什么想法吗? 非常感谢!

转到与您的网站关联的应用程序池的高级设置。

在常规部分将启用 32 位应用程序设置为真。

这应该可以解决问题。