I'm using the AD authentication in my asp.net MVC solution. It's working in a local server, but when I publish it I get the error: "System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred.". Does anybody know what I have to do?
2
votes
2 Answers
2
votes
Verify if you are publishing the dlls: System.DirectoryServices.dll and System.DirectoryServices.AccountManagement.dll.
Go to References in your web project, find both references, press f4 (properties tab), and set "Copy Local" to "True".
-- Added later
After, verify in your iis, if the setting "Asp.Net Impersonation" is enable. (Click in your web app in iis, and after, in Authorization icon)
0
votes
I found this part of code and its works now:
using (HostingEnvironment.Impersonate()) {
// This code runs as the application pool user
DirectorySearcher searcher ...
}
http://sanjaymungar.blogspot.com/2010_07_01_archive.html or http://sharepoint-tweaking.blogspot.com/2007/12/impersonation-in-aspnet-causes.html