我在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.