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

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL