“The specified domain either does not exist or could not be contacted.”
问题 I'm trying to use the DomainServices class to retrieve a list of OU's from my Active Directory. Here's my code: public List<OrganizationalUnit> FindOrganizationalUnits(string domainName, string domainExtension, string parentOrganizationUnit) { string tmpDirectory = String.Format("LDAP://ou={0},dc={1},dc={2}", parentOrganizationUnit, domainName, domainExtension ); DirectoryEntry directory = new DirectoryEntry(tmpDirectory); DirectorySearcher searcher = new DirectorySearcher(directory);