LDAP query results in "An operations error occurred."
i've written a windows service. service runs under local system account. service needs description provided in active directory of computers in domain. i'm using ldap. i'm not providing credentials, user ldap query should computer account. run query every few minutes. works without complaints several hours after starting service. eventually, fails following exception:
system.directoryservices.directoryservicescomexception (0x80072020): operations error occurred.
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.findall()
at networkindexservice.index()
the code query follows:
string ldappath = "ldap://" + environment.userdomainname; directoryentry de = new directoryentry(ldappath); directorysearcher ds = new directorysearcher(de); ds.filter = "(objectcategory=computer)"; searchresultcollection src = ds.findall();
once query fails, continues fail. if stop , start service, query start succeeding again. since code works, assume i'm doing nothing wrong , is a configuration issue elsewhere. i'm starting directory services log see if can figure out what's going on. i'd appreciate possible explanation. thanks.
you should consider using system.directoryservice.protocols instead of system.directoryservices. more robust ldap api. can find information on how use below:
http://msdn.microsoft.com/en-us/library/bb332056.aspx
Windows Server > Directory Services
Comments
Post a Comment