I have a ASP.NET 4.5 application that runs in an application pool with a particular domain user name and password. It's been working fine for months. A few days ago, there was an Active Directory issue whose details remain unknown to me, but my application users reported around the time of the issue that they were unable to use the application.
The AD issue was eventually "resolved," but the users still could not use the application - until I recycled the application pool.
Before the recycle, I was catching this first-chance exception:
System.Runtime.InteropServices.COMException (0x8007052E): The user name or password is incorrect.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
After the recycle, I stopped seeing this exception.
The exception itself was being generated by a call to PrincipalContext.FindByIdentity
that was failing until I recycled the app pool.
Why on Earth would an app pool recycle change the behavior of PrincipalContext
if the app pool credentials didn't change?