身份验证机制未知
我正在从活动目录访问用户信息。我的代码在我的本地 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试为用户主体或搜索者提供登录凭据。我以前也经历过同样的事情,如果我向我的 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.