UserPrincipal GetGroups在Windows Server 2008上非常慢

时间:2013-03-25 13:02:52

标签: c# active-directory

我有一种在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毫秒

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

非常感谢

0 个答案:

没有答案