2010-07-07 4 views
1

LDAP (Lightweight Directory Access Protocol)에서 사용자를 열거하려고 할 때 다음과 같은 오류가 발생합니다. 서버 (LDAP : // domainname)에 대한 연결 문자열을 확인했습니다. 서버는 물론 온라인이며 작동합니다.LDAP의 사용자를 열거하는 중 오류가 발생했습니다.

오류 메시지 : 서버가 작동
스택 추적하지

[2264] System.Transactions Critical: 0 : 
[2264] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The server is not operational. 
[2264] </Message><StackTrace> 
[2264] Server stack trace: 
[2264] at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) 
[2264] at System.DirectoryServices.DirectoryEntry.Bind() 
[2264] at System.DirectoryServices.DirectoryEntry.get_AdsObject() 
[2264] at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) 

업데이트 - 추가 코드

DirectoryEntry dirEntry = new DirectoryEntry("_LDAP://DOMAINNAME", "userName", "password"); 
System.DirectoryServices.DirectorySearcher dirSearcher = new System.DirectoryServices.DirectorySearcher(dirEntry); 
     try 
     { 
      foreach (SearchResult resEnt in dirSearcher.FindAll()) 
      { 
       DirectoryEntry de=resEnt.GetDirectoryEntry(); 
       foreach (string propname in de.Properties.PropertyNames) 
       { 
        //Add to the datatable 
       } 
      } 
     } 
     catch (Exception ex1) 
     { 
      //Log exception 
     } 
     finally 
     { 
      dirEntry.Dispose(); 
      dirSearcher.Dispose(); 
     } 

발생할 수있는이 expection가 많은 것이 이유에 대해 어떤 생각 고마워? 사전에

감사합니다,
바라 스 K

+0

사용자를 열거하는 데 사용 된 코드를 표시 할 수 있습니까? 어떤 LDAP 경로를 사용하고 있습니까 ?? –

+0

사용자를 열거하기위한 코드가 추가되었습니다. 서버가 있는지 확인했습니다 ... –

답변

0

는 그 이유가 내가 이름 대신 도메인 짧은 이름을 사용하는 것을 것을 발견했다. 올바른 형식은

DirectoryEntry dirEntry = new DirectoryEntry("LDAP://DOMAINFULLNAME", "userName", "password"); 
관련 문제