QueryInterface失败,并返回E_ACCESSDENIED [英] QueryInterface fails with E_ACCESSDENIED

查看:905
本文介绍了QueryInterface失败,并返回E_ACCESSDENIED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下方法是DCOM服务器方法。 COM客户端和服务器在不同的WinXP机器上运行。 COM客户端调用 RegisterClient 方法注册回调接口。问题是 QueryInterface 方法失败,错误代码 E_ACCESSDENIED 。可能的原因是什么?

The following method is a DCOM server method. The COM client and server is running in different WinXP machines. The COM client calls RegisterClient method to register callback interface. The problem is QueryInterface method fails with error code E_ACCESSDENIED. What could be the reason for the issue?

STDMETHODIMP CGEMExtension::RegisterClient(IUnknown** ppGEMExtensionEvents, int* nClientId, int* nResult)
{
    HRESULT  hRes = (*ppGEMExtensionEvents)->QueryInterface(IID_IGEMExtension,(void**)&pUnknown);
    return hRes;
}


推荐答案

获得E_ACCESSDENIED时,这意味着你有一个权限问题(不要耽搁你的防火墙或注册的时间 - 前者会提出错误,告诉你的服务不可用,后者会告诉你的类没有注册等等)。 COM依赖于Windows权限,所以这是你应该关注的。

When you get an E_ACCESSDENIED, it means you have a permissions problem (don't waist your time on firewalls or registrations - the former will raise errors telling you the service is not available, and the latter will tell you the class is not registered or so). COM relies on Windows permissions, so this is what you should focus on.

在你的情况下,如果我理解的情况下,服务器实际上调用客户端以获得正确的界面。为此,运行服务器的用户应该在客户端具有正确的权限。几个建议:

In your case, if I understand the case correctly, the server actually calls the client, in order to get the right interface. For that, the user running the server should have the right permissions on the client side. A few suggestions:


  1. 正如daramarak建议,让服务器和客户端使用相同的域用户,

  2. 在客户端上,设置此设置为经典。

  3. 向服务器的用户授予使用< a href =http://msdn.microsoft.com/en-us/library/ms690141%28v=vs.85%29.aspx =nofollow> DCOMCNFG

  1. As daramarak suggests, have the server and the client use the same domain user, or the same local user with the same password.
  2. On the client, set this setting to "classic".
  3. Give the server's user, if known to the client, additional permissions using DCOMCNFG.

这篇关于QueryInterface失败,并返回E_ACCESSDENIED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆