【问题标题】:System.DirectoryServices.DirectoryServicesCOMException occurs only with Google ChromeSystem.DirectoryServices.DirectoryServicesCOMException 仅在 Google Chrome 中发生
【发布时间】:2017-06-15 05:28:36
【问题描述】:

在远程 IIS 8.5 上带有 ApplicationPoolIdentity 的 MVC 应用程序。在 IE11 上运行良好,但在使用谷歌浏览器时,我得到一个带有 System.DirectoryServices.DirectoryServicesCOMException 的黄屏

这是导致错误的代码

 protected void Session_Start()
    {
        // Load current AD user
        UserPrincipal user = UserPrincipal.Current;
        Session.Add(name: "DisplayName", value: user.DisplayName);
        Session.Add(name: "AccountName", value: user.SamAccountName);
    }

此外,在我的 Web.config 文件中,我有 <identity impersonate="true" /><validation validateIntegratedModeConfiguration="false" /> 最后一点是我发现让事情正常进行的唯一方法。但它只适用于 IE。

为什么它在 IE11 中可以正常工作,但在 Chrome 中却不行?我做错了什么?

更新 #1

当使用HostingEnvironment.Impersonate() 包装对 Active Directory 的每个调用时,我可以使它工作。但是当我尝试使用 user.Save() 更改 AD 中的帐户时,它仍然给我一个黄屏

System.UnauthorizedAccessException: Access denied.

我没有对 Active Directory 域的完全访问权限,但我可以在我的 OU 中重置密码和启用/禁用帐户。

【问题讨论】:

    标签: asp.net-mvc google-chrome asp.net-mvc-4 impersonation iis-8.5


    【解决方案1】:

    https://stackoverflow.com/a/14545336/75172

    使用这个类来包装对 AD 的每个调用解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-26
      • 2021-08-24
      • 2013-06-15
      相关资源
      最近更新 更多