[英]ASP.Net Core 2.0 referencing COM objects works locally but not when deployed
I have ASP.Net Core 2.0 MVC app that references several COM objects. 我有引用几个COM对象的ASP.Net Core 2.0 MVC应用程序。 I've referenced the COM objects via Visual Studio's Add Reference process. 我已经通过Visual Studio的“添加引用”过程引用了COM对象。 References show in my solution such as 参考资料显示在我的解决方案中,例如
Interop.XYZ 互操作
VS automatically set the Embed Interop Types to true, as it's supposed to do. VS可以自动将Embed Interop Types设置为true。
The solution builds and runs and I can successfully use the methods in these references locally. 该解决方案可以构建并运行,我可以在本地成功使用这些引用中的方法。
When I publish it to IIS on another machine though I get this error: 当我将其发布到另一台计算机上的IIS时,出现以下错误:
Retrieving the COM class factory for component with CLSID {5D9E1092-69D4-11D2-BCBB-0000E82BB3D3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). 由于以下错误,检索具有CLSID {5D9E1092-69D4-11D2-BCBB-0000E82BB3D3}的组件的COM类工厂失败:80040154未注册类(HRESULT的异常:0x80040154(REGDB_E_CLASSNOTREG))。
My app pool has Enable 32 Bit Applications set to true. 我的应用程序池将“启用32位应用程序”设置为true。 In my Project Properties, Platform target is set to Any CPU (I tried forcing it to x86 and the site won't even run on IIS after publishing). 在我的项目属性中,平台目标设置为任何CPU(我尝试将其强制为x86,并且发布后该站点甚至无法在IIS上运行)。
I made a clone of the app using .Net 4.7 and configured it the same way, using the same COM references, and published to a second site on the same server. 我使用.Net 4.7克隆了该应用程序,并使用相同的COM引用以相同的方式对其进行了配置,然后将其发布到同一服务器上的另一个站点。 The published version of that app works fine so I don't think it's an issue with the assemblies not being registered (should't be in any case since Embed Interop Types is true for all the COM referenes). 该应用程序的发布版本运行良好,因此我认为这与未注册程序集无关(在任何情况下都不会出现此问题,因为Embed Interop Types对于所有COM参照都是正确的)。
Anybody know what's going on? 有人知道发生了什么吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.