7

我有一种在 Windows 2008 AD 上获取用户组的方法。

using (var domainContext = new PrincipalContext(ContextType.Domain, domain, login, pwd))
{
    using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, samAccountName))
    {
        if (foundUser != null)
        {
            var grs = foundUser.GetGroups(domainContext);
            ....
        }
    }
}

该批次在 Windows Server 2003 和 XP 上运行良好,但我在 Windows Server 2008 上的响应非常慢,这行:

foundUser.GetGroups(domainContext);
  • Windows Server 2003 和 XP:调用需要 100 毫秒
  • Windows Server 2008:调用需要 2500 毫秒

你能帮我解决这个问题吗?

非常感谢

4

0 回答 0