【问题标题】:InvalidCastException for COM object in Windows Server 2008Windows Server 2008 中 COM 对象的 InvalidCastException
【发布时间】:2012-05-06 05:35:05
【问题描述】:

我遇到了一个与部署在 Windows Server 2008(x64 版本)上的 IIS7 上的 C# 服务通信的站点的问题。 该服务正在尝试从第三方 dll 访问 COM 对象。什么时候这样做会引发以下形式的异常:

System.InvalidCastException: Unable to cast COM object of type 'MyClass' to interface type 'TheirInterface'. 
This operation failed because the QueryInterface call on the COM component for the interface with IID '{88B11E8A-0B27-459C-BC28-A4D4113FD4AE}' failed due 
to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

我在许多其他运行 Windows 7 的机器上托管了同一个站点,所以我认为问题与操作系统(Windows Server 2008)有关。 关于我在哪里可以搜索此异常的解决方案的任何建议,或者是否应该在 IIS 上进行任何配置?

【问题讨论】:

    标签: c# windows iis com


    【解决方案1】:

    您需要将网站作为 32 位网站运行或使用针对 x64 平台编译的 COM 对象。换句话说,您的 COM 对象无法加载,因为它只支持由 32 位进程加载。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-01
      • 2016-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多