简体   繁体   中英

DirectoryServicesCOMException (0x80072030) when trying to access active directory

I'm trying to access AD data via ldap with the connection like: LDAP://dc1.corp:port/OU=Users,DC=domain,DC=com

Then using the directorySearcher.FindOne().GetDirectoryEntry(); This 100% works on my machine, but when I do this on the server it throws DirectoryServicesCOMException (0x80072030) There is no such object on the server.

I found the similar question on so, but it doesn't help. Currently I'm looking for the way to at least understand why there is a difference for ldap access on my local PC and on the server.

For me the problem was in permissions under which the application pool was running. What I did to investigate was 1 console app and 1 web app. And I noticed, that when I ran the console app it got the data from AD immediately. And web app always throw that COM exception. I'm not 100% sure what exact permissions are needed to give web app the access to the AD( I dont know the exact difference between the local system account and my domain user account that matters) but hope this will help someone to solve the similar problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM