You will be getting this error if you are using .NET 4.0 and the good news is that its not happening because you are doing anything wrong, rather its a known bug in .NET 4.0 and has been fixed in .NET 4.5.
If you cannot upgrade your .NET version to .NET 4.5 then you can do the following simple workaround to dodge this nasty error.
Instead of creating the PrincipalContext as follows:
principalContext = new PrincipalContext(ContextType.Domain)
Specify your domain explicitly:
principalContext = new PrincipalContext(ContextType.Domain,"MYDOMAIN")
No comments:
Post a Comment
Your comments are highly appreciated!