ApplicationPoolIdentity permissions and UserPrincipal

3

I've been receiving a COM Exception when performing an AD Search in an ASP.NET 4.0: An operations error occurred (0x80072020)

The thread Active Directory COM Exception - An operations error occurred (0x80072020) pointed me in the right direction - The issue described is permissions-related.

As a workaround, I switched the Application Pool Identity from ApplicationPoolIdentity to NetworkService and was able to perform the query without error. The confusing part about this is that on another IIS7 webserver on the same domain, I was able to leave the Application Pool Identity as ApplicationPoolIdentity.

Is there something that I am missing to make this query work using ApplicationPoolIdentity?

FWIW, the code was fairly straightforward:

PrincipalContext context = new PrincipalContext(ContextType.Domain, theDomain);
UserPrincipal p_up = new UserPrincipal(context);
p_up.GivenName = "John"; //error occurred here
p_up.Surname = "Doe";
PrincipalSearcher ps = new PrincipalSearcher(p_up);
PrincipalSearchResult<Principal> psr = ps.FindAll();
asp.net
iis-7
application-pool
directoryservices
asked on Stack Overflow Sep 21, 2012 by ARP • edited May 23, 2017 by Community

1 Answer

0

Maybe it can depended on domain LDAP access configuration for computers. But NetworkService and ApplicationPoolIdentity should access network under computer account...

answered on Stack Overflow May 6, 2013 by Fanda

User contributions licensed under CC BY-SA 3.0