0

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

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.
4

0 回答 0