2011-03-01 55 views
1

我正在使用Com对象。 com服务器应该从作为特定帐户运行的Windows服务中使用。但是,在此帐户中运行时,它无法加载com,因此出现以下异常:从IClassFactory创建CLSID为{36998A63-857C-4​​B87-BC5E-72B7B3573F80}的COM组件实例失败,原因如下:80010105从LocalSystem使用Com类

我尝试将帐户更改为LocalSystem,但仍然失败,但更改了Windows服务以便以我自己的帐户登录。

我想它与我的帐户上安装的com服务器有关。我使用“它是name.exe/regserver”来安装com。我尝试以LocalSystem身份运行该命令,然后失败并导致断言。我没有代码,所以我不知道问题出在哪里,是否应该检查我的许可? 我也尝试在Visual Studio中切换嵌入式互操作类型。

任何帮助?

+0

您是否使用DCOM配置设置了激活权限? – sharptooth 2011-03-01 10:17:07

+0

嗨锐利。我不知道这是什么,所以可能不是 – Karsten 2011-03-01 10:46:25

+0

我启动了DCOMCNFG.EXE并试图找到它,但我不能 – Karsten 2011-03-01 10:52:31

回答

3

您看到的错误是RPC_E_SERVERFAULT,这意味着在进程外COM服务器中存在未处理的Win32异常(例如,可能是访问冲突)。如果您既没有COM服务器的源代码也没有调试符号,那么您不太可能能够诊断或自行修复它。 (编辑:除非是在64位机:-)一些明显像“位数”的不匹配)

选项:

  • 如果你应该能够激活 服务器并消耗其COM 对象在您的 服务的帐户的上下文中,那么您将需要 与 服务器的供应商提出此问题,并让他们诊断和 修复它;
  • 可以使用DCOMCNFG.EXE(身份 标签)来配置COM服务器 你的身份下运行,而不是默认的 (这是“启动用户”),看看这是否避免了出错的问题(它听起来你说它可能会)。
+0

实际上,由于问题可能缺乏某些权限,因此可以使用Process Monitor来尝试诊断问题。 – sharptooth 2011-03-01 12:29:14

+0

@sharptooth:我可能错了(没有官方的Microsoft文档),但根据我的经验,RPC_E_SERVERFAULT通常表示服务器实现中的一个更基本的问题,例如访问冲突或被零除错误。缺少所需的权限通常会显示为E_ACCESSDENIED(0x80070005)的HRESULT。尽一切手段看看Process Monitor是否可以告诉你任何事情,但我不知道你在找什么。 – 2011-03-01 12:43:16

+0

...或“位”的不匹配:-) – 2011-03-01 12:48:17

2

我刚刚在我们的朋友Hans Passant的微软新闻组线上发现了这个。我希望汉斯不会介意我引用它,这是非常好的和有针对性的。

Ah, the dreaded RPC_E_SERVERFAULT. RPC installs an SEH handler in the stub that catches any SEH exception the occurs in the COM server. Even the really bad ones like AV. The client is notified about the exception with 0x80010105. Which is awful, there's no way to get any information whatsoever about the exception. Even worse, the server just keeps running, now typically with a radically messed up internal state due to the exception. There's nothing you can do about it but trying to debug the COM server to find out why it is throwing exceptions. If it is a black box to you, you'll have a heck of a time without support from the COM component vendor.