System.DirectoryServices.AccountManagement.PrincipalContext and Impersonation in a WCF service
问题 Working with the PrincipalContext in code that lies behind a WCF service. The WCF service is impersonating, to allow a 'pass-through' type authentication. While everything else I do with Active Directory (mostly the System.DirectoryServices.Protocols namespace) works fine in this scenario, for some reason the classes in System.DirectoryServices.AccountManagement throw a fit. Sample code that fails: PrincipalContext context = new PrincipalContext(ContextType.Domain, domainName); UserPrincipal