有没有办法为UserPrincipal.FindByIdentity()启用引荐追逐?

我有一个使用System.DirectoryServices.AccountManagement类的.NET 3.5 Web应用程序。当我搜索一些用户时,我得到一个PrincipalOperationException:从服务器返回一个引用。如果我使用自己的LDAP代码执行旧学校的方式,我可以启用追踪推荐。我需要重写我的代码吗? 我的代码看起来像这样:
   using (var principalContext = new PrincipalContext(ContextType.Domain, null, adPath))
    {

        // Find the principal object for which you wish to enumerate group
        // membership.
        using (var userPrincipal = UserPrincipal.FindByIdentity(principalContext, identity))
        {
            if (userPrincipal != null)
            {
                Name = userPrincipal.DisplayName;
                DistinguishedName = userPrincipal.DistinguishedName;
                EmailAddress = userPrincipal.EmailAddress;
                Sid = userPrincipal.Sid.Value;
            }
        }
    }
我的adPath可以是2个值中的一个。其中一个值是最近加入的域,可以使用不同的工具进行访问。我相信这是.NET库如何进行LDAP调用的问题。     
已邀请:
这是一个部分答案,因为评论太长了。 根据这篇Microsoft文档,您甚至知道,推荐是客户可以追逐的暗示。但是关于RODC,他们添加“例如,在LDAP应用程序的情况下,如果在客户端和RODC之间的LDAP连接上启用了追踪引用,则应用程序永远不会知道客户端从RODC接收了引用。客户端是自动重定向到引用中指定的可写域控制器。“ 所以我看看如何在Microsoft站点中启用LDAP追踪连接,我发现这意味着ADSI的使用。我对答案非常感兴趣。 您是否尝试像这样查询全局编录:
/* Retreiving a principal context
 */
PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, "YourGCServer:3268", "dc=dom,dc=fr", "User", "Password");
它应该包含所有林域的数据。 我希望它有所帮助。     
您是否尝试过表单的代码(将域作为第二个参数):
var principalContext = new PrincipalContext(ContextType.Domain, "office.local", "OU=Users, DC=office, DC=local" ))
还要确保
adPath
从最具体到最不具体。     

要回复问题请先登录注册