I have a simple setup below to search for users.
DirectoryEntry rootEntry = new DirectoryEntry("LDAP://someserver:123/OU=d-users,DC=domain,DC=x,DC=y,DC=com");
rootEntry.AuthenticationType = AuthenticationTypes.None;
string filter = "sAMAccountName=" + AccountName;
DirectorySearcher searcher = new DirectorySearcher(rootEntry, filter);
SearchResult foundUser = searcher.FindOne();
For some reason I can search via a simple Console/windows forms app but cannot search from a wcf or asmx service (v4.0, Integrated) on IIS(6.1). The exception is below;
exception:System.Runtime.InteropServices.COMException (0x8007200A): The specified directory service attribute or value does not exist.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
at Tester.FindAccountByName(String AccountName)