身份验证机制未知

发布于 2024-12-22 16:12:51 字数 840 浏览 2 评论 0原文

我正在从活动目录访问用户信息。我的代码在我的本地 PC 上运行良好(具有 Windows XP,而不是在域上)。代码是

            PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domainName", "ActiveDirectoryID", "Password");

            UserPrincipal qbeUser = new UserPrincipal(ctx);
            PrincipalSearcher srch = new PrincipalSearcher(qbeUser);
            qbeUser.SamAccountName = "AnyOther_AD_ID"; //To get any one's info
            foreach (var found in srch.FindAll())
            {
                UserPrincipal foundUser = found as UserPrincipal;
                if (foundUser != null)
                {
                    emailAddress = foundUser.EmailAddress;
                 }
            }

但是当我将应用程序部署到服务器电脑(Windows Server 2003,在域上)时。它给出错误“身份验证机制未知”。 让我震惊的问题是服务器,即在域上无法访问 AD 信息,但我的本地电脑,不在域上可以访问 AD 信息(我得到了 AD_Id 和密码)。

I am accessing user information from active directory. My code is working well on my local PC (having windows xp, not on domain). The code is

            PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domainName", "ActiveDirectoryID", "Password");

            UserPrincipal qbeUser = new UserPrincipal(ctx);
            PrincipalSearcher srch = new PrincipalSearcher(qbeUser);
            qbeUser.SamAccountName = "AnyOther_AD_ID"; //To get any one's info
            foreach (var found in srch.FindAll())
            {
                UserPrincipal foundUser = found as UserPrincipal;
                if (foundUser != null)
                {
                    emailAddress = foundUser.EmailAddress;
                 }
            }

But when i deploy my application to server pc (windows server 2003, on domain). It gives the error "The authentication mechanism is unknown".
The question that strikes me is the server, that is on domain can not access AD info but my local pc, that is not on domain can access AD info (I am given AD_Id and Password).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深缘浅 2024-12-29 16:12:51

尝试为用户主体或搜索者提供登录凭据。我以前也经历过同样的事情,如果我向我的 AD 连接提供了用户名和密码,密码就可以了。

try providing login credentials for the user principle or searcher. I have experienced the same thing before and if I supplied my AD connection with a username & password it would work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文