windows 来自 HRESULT 的异常:0x80029C4A(TYPE_E_CANTLOADLIBRARY)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3651044/
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
Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)
提问by femseks
I'm creating a windows service on a windows 2003 machine, using dsofile to modify custom properties on a bunch of documents. This works fine until I install the service on a win2k8 machine where it gives me the following error:
我正在 Windows 2003 机器上创建 Windows 服务,使用 dsofile 修改一堆文档的自定义属性。这工作正常,直到我在 win2k8 机器上安装该服务,它给我以下错误:
ERROR [2010-09-06 13:17:12,317] An unknown error occured: System.InvalidCastException: Unable to cast COM object of type 'DSOFile.OleDocumentPropertiesClass' to interface type 'DSOFile._OleDocumentProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{58968145-CF01-4341-995F-2EE093F6ABA3}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
错误 [2010-09-06 13:17:12,317] 发生未知错误:System.InvalidCastException:无法将类型为“DSOFile.OleDocumentPropertiesClass”的 COM 对象转换为接口类型“DSOFile._OleDocumentProperties”。此操作失败,因为 IID 为“{58968145-CF01-4341-995F-2EE093F6ABA3}”的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:加载类型库/DLL 时出错。(来自 HRESULT 的异常:0x80029C4A (TYPE_E_CANTLOADLIBRARY))。
All my projects are set to run as x86, and Ive used procmon to monitor the files requested without any clues.. Anyone have any ideas on how to solve this?
我所有的项目都设置为以 x86 运行,并且我使用 procmon 来监视请求的文件而没有任何线索。任何人对如何解决这个问题有任何想法吗?
回答by t0mm13b
Since you have mentioned that you are running a service under Win2008,
既然你提到你在Win2008下运行服务,
- The first clue is, is the DSO File dll componentpart of Office, what version? is that installed?
- I am not sure if a service can access such a office component running as a system account user which could be open to malicious exploits whilst running under said account as a service...
- TYPE_E_CANTLOADLIBRARY should be as a result of the first option given...
- 第一个线索是,Office的DSO File dll组件是什么版本?是安装了吗?
- 我不确定服务是否可以访问这样一个以系统帐户用户身份运行的办公组件,该组件在作为服务在所述帐户下运行时可能会受到恶意攻击...
- TYPE_E_CANTLOADLIBRARY 应该是第一个选项的结果...
回答by Alessandro Jacopson
I had a similar problem and I solved it due to the explanation by Geoff Darst - MSFT. I adjusted his original answer to fit your interface IID:
我遇到了类似的问题,由于Geoff Darst-MSFT的解释,我解决了它。我调整了他的原始答案以适合您的界面 IID:
Sounds like you have a problem with your typelib registration. Presumably, the Com interop layer is hitting the registry to try to locate the typelib. It would start by looking under HKCR\Interface{58968145-CF01-4341-995F-2EE093F6ABA3}\Typelib. The default value should refer to the guid for the typelib that defines the interface in question: which should be located under the following key: HKCR\Typelib{what found in the aforementioned Interface key}. There should be a version subkey and then a 0 subkey, and a win32 subkey under that. The default value of the win32 key should point to the right typelib.
听起来您的 typelib 注册有问题。据推测,Com 互操作层正在访问注册表以尝试定位 typelib。首先查看 HKCR\Interface{58968145-CF01-4341-995F-2EE093F6ABA3}\Typelib。默认值应引用定义相关接口的 typelib 的 guid:它应位于以下键下:HKCR\Typelib{在上述接口键中找到的内容}。应该有一个 version 子项,然后是一个 0 子项,然后是一个 win32 子项。win32 键的默认值应该指向正确的类型库。