E
E
egotyner2015-07-18 06:37:18
Active Directory
egotyner, 2015-07-18 06:37:18

[C#] When trying to work with Active Directory, for any action, an error occurs (inside). How to fix?

Error: System.Runtime.InteropServices.COMException (0x8007054B): The specified domain does not exist or cannot be contacted.
From the administrator launched, gave the rights, all the same gives this exception. Windows 8.1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MrDywar Pichugin, 2015-07-18
@Dywar

DirectorySearcher specified ?
For example:

var searchRoot = new DirectoryEntry(@"LDAP://DC=subdom,DC=ourdomain,DC=com", @"domain\iis-appPool-username", "password");
searchRoot.AuthenticationType = AuthenticationTypes.ReadonlyServer;

using (var searcher = new DirectorySearcher(searchRoot)) // Specify the search root here
{
  searcher.Filter = string.Format("(&(objectClass=group)(sAMAccountName={0}))", "someGroupName");
  searcher.PropertiesToLoad.Add("distinguishedName");

  var result = searcher.FindOne();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question