DomainContect正在引发“登录失败:未知用户名或密码错误”。

时间:2014-01-06 13:00:58

标签: asp.net asp.net-mvc-4 windows-authentication domaincontroller

我在asp.net mvc Web应用程序中有以下代码来检索Active目录用户名: -

public List<DomainContext> GetADUsers(string term=null)
{
    List<DomainContext> results = new List<DomainContext>();

    using (var context = new PrincipalContext(ContextType.Domain, "v800047"))
    using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
    {

以上在我们的开发环境中运行良好,但是当我将代码移动到登台服务器并且我相应地更改了AdServerName时,我收到以下错误: -

Description: An unhandled exception occurred during the execution of the current 
web request. Please review the stack trace for more information about the error 
and where it originated in the code. 

 Exception Details: System.DirectoryServices.DirectoryServicesCOMException: 
     Logon failure: unknown user name or bad password.

0 个答案:

没有答案