Attempted to access an unloaded appdomain when using System.DirectoryServices

Here is what works for me (.Net 4):

Instead of this:

principalContext = new PrincipalContext(ContextType.Domain)

create the principal context with the domain string as well:

E.g.

principalContext = new PrincipalContext(ContextType.Domain,"MYDOMAIN")

It should be fixed in 4.5. See comment, hasn’t been fixed yet, but adding the second argument still works as workaround.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)