2009-11-17 4 views
0

C#의 새로운 기능. 특정 OU에 대해 AD를 검색하려고합니다. 다음과 같은 오류가 발생합니다. 오류 코드 2147016646. 높은 privl 프로그램을 실행 해 보았습니다. acct. 하지만 여전히 같은 오류가 발생합니다.활성 디렉토리 서버가 작동하지 않습니다. 오류 코드 2147016646

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.DirectoryServices; 
using System.DirectoryServices.ActiveDirectory; 

namespace ConsoleApplication1 
{ 
    class Program 
    { 

     static void Main(string[] args) 
     { 
      string objectPath = "Server1"; 
      try 
      { 
       if (DirectoryEntry.Exists("LDAP://" + objectPath)) 
        Console.WriteLine(objectPath + "exists"); 
       else 
        Console.WriteLine(objectPath + " does not exists"); 
      } 
      catch (DirectoryServicesCOMException e) 
      { 
       Console.WriteLine(e.Message.ToString()); 
      } 
     }  
    } 
} 

답변

1

LDAP 경로에는 "Server1"이상의 것을 사용해야 할 것입니다.

시도 뭔가처럼 : 서버의 기본 "사용자"컨테이너가 (여부)이있는 경우

string objectPath = "Server1/cn=Users,dc=yourcompany,dc=som"; 
try 
{ 
    if (DirectoryEntry.Exists("LDAP://" + objectPath)) 
     Console.WriteLine(objectPath + "exists"); 
    else 
     Console.WriteLine(objectPath + " does not exists"); 
} 

이 확인됩니다.

마크

-3

가 높은 추천 무게의 금 ISBN 0-321-35017-0

가치는 ".NET 개발자 가이드를 디렉터리 서비스 프로그래밍!"

+0

책을 추천하면 여기에서 묻는 특정 질문에 대한 답변이 없습니다. –

관련 문제