【问题标题】:Error on publishing: System.DirectoryServices.DirectoryServicesCOMException发布时出错:System.DirectoryServices.DirectoryServicesCOMException
【发布时间】:2012-02-07 18:06:54
【问题描述】:

我在我的 asp.net MVC 解决方案中使用 AD 身份验证。它在本地服务器上运行,但是当我发布它时出现错误:“System.DirectoryServices.DirectoryServicesCOMException:发生操作错误。”。有人知道我要做什么吗?

【问题讨论】:

    标签: c# asp.net-mvc active-directory


    【解决方案1】:

    验证您是否要发布 dll:System.DirectoryServices.dll 和 System.DirectoryServices.AccountManagement.dll。

    在您的 Web 项目中转到 References,找到两个引用,按 f4(属性选项卡),然后将“Copy Local”设置为“True”。

    -- 稍后添加

    之后,在您的 iis 中验证是否启用了“Asp.Net Impersonation”设置。 (在 iis 中单击您的网络应用程序,然后在授权图标中)

    【讨论】:

    • 在您的 iis 中验证是否启用了“Asp.Net 模拟”设置。 (在 iis 中单击您的网络应用程序,然后在授权图标中)
    【解决方案2】:

    我现在找到了这部分代码及其工作:

     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

    【讨论】:

      猜你喜欢
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多