发布时出错:System.DirectoryServices.DirectoryServicesOMException

本文关键字:DirectoryServices DirectoryServicesOMException System 布时 出错 | 更新日期: 2023-09-27 18:22:50

我在asp.net MVC解决方案中使用AD身份验证。它在本地服务器上工作,但当我发布它时,我收到错误:"System.DirectoryServices.DirectoryServicesOMException:发生操作错误。"。有人知道我该怎么办吗?

发布时出错:System.DirectoryServices.DirectoryServicesOMException

验证是否正在发布dll:System.DirectoryServices.dll和System.DirectoryServices.AccountManagement.dll。

转到web项目中的引用,找到两个引用,按f4(属性选项卡),然后将"复制本地"设置为"True"。

--添加了后期

之后,在iis中验证设置"Asp.Net模拟"是否已启用。(在iis中单击web应用程序,然后在授权图标中单击)

我现在发现了这部分代码及其工作原理:

 using (HostingEnvironment.Impersonate()) {
    // This code runs as the application pool user
         DirectorySearcher searcher ...
    }

http://sanjaymungar.blogspot.com/2010_07_01_archive.html或http://sharepoint-tweaking.blogspot.com/2007/12/impersonation-in-aspnet-causes.html

相关文章:
  • 没有找到相关文章