Problem:
Using MVC 5 application and the namespace System.DirectoryServices.AccountManagement.I kept getting this error intermittently running my app. Looks like an issue in ADSI which is a bit buggy.
Solution:
Tofumaster's suggestion of adding the domain string to the principal context seems to have done the trick for me.instead of
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
do this
PrincipalContext ctx = new PrincipalContext(ContextType.Domain,"MyDomain");
Source:
- http://stackoverflow.com/questions/6605666/querying-active-directory-from-mvc-result-in-attempted-to-access-an-unloaded-ap
- http://forums.asp.net/t/1697428.aspx?Querying+Active+Directory+from+MVC+result+in+Attempted+to+access+an+unloaded+appdomain+Exception+from+HRESULT+0x80131014+
- http://stackoverflow.com/questions/5895128/attempted-to-access-an-unloaded-appdomain-when-using-system-directoryservices
No comments:
Post a Comment