相关疑难解决方法(0)

FindByIdentity - 性能差异

以下代码可以在我们域上的各种计算机上正常运行.

var context = new PrincipalContext(ContextType.Domain);
var principal = UserPrincipal.FindByIdentity(context, @"domain\username")
Run Code Online (Sandbox Code Playgroud)

但是,如果我在不在域上的计算机上运行此类似的代码,它可以工作,但FindByIdentity行需要2秒以上.

var context = new PrincipalContext(ContextType.Machine);
var principal = UserPrincipal.FindByIdentity(context, @"machinename\username")
Run Code Online (Sandbox Code Playgroud)

通过向PrincipalContext构造函数和/或FindByIdentity方法提供特殊参数,可以解决这种性能差异吗?IIS或Windows中是否有可以调整的设置?

至少,任何人都可以告诉我为什么在第二种情况下它可能会变慢?

该代码从Windows Server 2008 R2上的IIS 7.5(集成管道)中托管的ASP.NET MVC 3应用程序运行.

.net iis-7 directoryservices

16
推荐指数
1
解决办法
5161
查看次数

标签 统计

.net ×1

directoryservices ×1

iis-7 ×1