【问题标题】:PrincipalServerDownException on Windows XP but not on Windows 7PrincipalServerDownException 在 Windows XP 上但在 Windows 7 上没有
【发布时间】:2012-06-09 06:39:26
【问题描述】:

我们有一个完全信任运行的 WPF 应用程序。

应用程序的一部分检查 Windows AD 组的成员资格。

这在 Windows 7 机器上运行良好,但在 Windows XP 机器上却不行。

错误发生在以下行:

PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domain name");

【问题讨论】:

    标签: c# windows-7 active-directory windows-xp principalcontext


    【解决方案1】:

    根据文章Managing Directory Security Principals in the .NET Framework 3.5,可能不需要“域名”变量。也就是说,如果您正在访问与您的应用程序位于同一域中的 Active Directory,则不需要该域名。

    您在 PrincipalContext 构造函数中使用 name 参数 命令提供要连接到的特定目录的名称。 这可以是特定服务器、机器或域的名称。它是 需要注意的是,如果这个参数为空,AccountManagement 将尝试为 基于您当前的安全上下文的连接。

    该问题的解决方案或解决方法(至少在 XP 和 W7 上都对我有用)是以下更改:

    PrincipalContext ctx = new PrincipalContext(ContextType.Domain, null);
    

    【讨论】:

      猜你喜欢
      • 2014-02-06
      • 2011-03-21
      • 2011-03-03
      • 2012-09-20
      • 2012-07-17
      • 2012-07-04
      • 2012-05-17
      • 1970-01-01
      • 2012-02-08
      相关资源
      最近更新 更多