Active Directory COM异常 - 发生操作错误(0x80072020) [英] Active Directory COM Exception - An operations error occurred (0x80072020)
问题描述
当我尝试使用方法 发生操作错误(0x80072020) //msdn.microsoft.com/en-us/library/bb344648.aspxrel =nofollow noreferrer> GroupPrincipal.FindByIdentity
I am getting an intermittent COM Exception "An operations error occurred (0x80072020)" (shown below) when I try and query Active Directory using the method GroupPrincipal.FindByIdentity
这是我的代码:
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Environment.UserDomainName);
GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "Group to find");
我收到异常:
Inner Exception: System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer()
at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()
at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()
at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)
at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue)
at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue)
代码从 Windows服务运行在 Windows 2003 SP2服务器上。
我发现另一个Stack Overflow问题, Active Directory,枚举用户组,COM异常,表明启用Kerberos 为在PrincipalContext构造函数中的选项将解决这个问题,但是我收到一个不同于这个问题的十六进制代码。
I have found another Stack Overflow question, Active Directory, enumerating user's groups, COM exception, suggesting that enabling Kerberos as an option in the PrincipalContext constructor will fix this problem but I am receiving a different hex code than in this question.
我的问题是:
- 这个特殊的COM异常是否是一个认证问题?我需要确保在发布软件之前100%解决问题。
- 是否有资源列出所有可能的COM异常十六进制代码,以便我可以帮助自己
推荐答案
我已经找到另一个答案无法在Dynamics CRM中添加使用CrmService API的用户,其中指出那个0x80072020确实是一个权限问题。我已经将我的服务改为在域级帐户下运行,而不是本地系统帐户,这似乎已经解决了我的问题。
I've now found another answer Unable to add user with CrmService API in Dynamics CRM which states that 0x80072020 is indeed a permission issue. I have changed my service to run under a domain level account instead of the local system account and this seems to have cured my problem.
这篇关于Active Directory COM异常 - 发生操作错误(0x80072020)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!