title: How to connect to Active Directory with Principal Context?
body: <p>I've been at this for a while and I'm always getting:</p>
  
  <blockquote>
    <p>System.DirectoryServices.AccountManagement.PrincipalServerDownException</p>
  </blockquote>
  
  <p>Which I think means my connection setup(connection string) is wrong.</p>
  
  <p>When I write "dsquery server" on cmd on the computer where the Active Directory is I get:</p>
  
  <blockquote>
    <p>"CN=DCESTAGIO,CN=SERVERS,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=estagioit,DC=local"</p>
  </blockquote>
  
  <p>I've tried the following connecting in the following ways:</p>
  
  <p>1:</p>
  
  <pre><code>PrincipalContext thisPrincipalContext = new PrincipalContext(ContextType.Domain, "192.168.56.101", "DC=estagioit,DC=local");
  </code></pre>
  
  <p>2:</p>
  
  <pre><code>PrincipalContext thisPrincipalContext = new PrincipalContext(ContextType.Domain, "192.168.56.101/DC=estagioit,DC=local");
  </code></pre>
  
  <p>3:</p>
  
  <pre><code>PrincipalContext thisPrincipalContext = new PrincipalContext(ContextType.Domain, "192.168.56.101/CN=DCESTAGIO,DC=estagioit,DC=local");
  </code></pre>
  
  <p>4:</p>
  
  <pre><code>PrincipalContext thisPrincipalContext = new PrincipalContext(ContextType.Domain, "192.168.56.101/CN=DCESTAGIO,CN=SERVERS,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=estagioit,DC=local");
  </code></pre>
  
  <p>5:</p>
  
  <pre><code>PrincipalContext thisPrincipalContext = new PrincipalContext(ContextType.Domain, "LDAP://192.168.56.101/CN=Users,DC=estagioit,DC=local");
  </code></pre>
  
  <p>And some other ways...</p>
  
  <p>Any ideas on what's wrong and how I can make this connection work?</p>
  
  <p>PS: The ip is correct seen as I've used it to ping and it's working.</p>
  
  <p>PPS: I really, really need this working ASAP if you have any suggestions at all they're all welcome.</p>