【发布时间】:2017-10-13 08:45:33
【问题描述】:
在一个 asp.net MVC 应用程序中,我在尝试使用 directoryEntry.Invoke 重置密码时遇到 Access denied 错误。
用户试图更改他/她的密码访问该页面,并且在 IIS 中标记了 SSL required 和 Client Certificates - Required。
相关代码:
directoryEntry.Invoke("SetPassword", new object[] { model.Password });
directoryEntry.Properties["LockOutTime"].Value = 0;
directoryEntry.Close();
确切的错误是——
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
--- End of inner exception stack trace ---
at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)
Web.config –
<authentication mode="Windows" />
<identity impersonate="false" />
<authorization>
<deny users="?" />
</authorization>
- 应用程序池在 AD 帐户下运行;也是当地的一部分
管理员组
[Domain1\AppPoolUser]。 - 应用程序请求用户证书
- 尝试更改密码
[Domain2\testUser]的用户和运行应用程序池的帐户位于不同的域中,但这可能不是问题。 AppPoolUser 的有效权限允许在 testUser 帐户上更改密码。 - 我什至尝试在与 测试帐户,但它不会改变任何东西。
已经在网上查过了,但我不清楚可能是什么问题。我看到的最相关的是这个 - Setting ASP.Net Permissions - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
但是,正如我所提到的,应用程序池在有限的技术帐户下运行,我认为 SSL 证书没有任何问题。
- 我是否需要为 AD 中的应用程序池帐户请求控制委派?
- 或者我可能缺少另一个问题。
【问题讨论】:
-
你能解决这个问题吗?
标签: asp.net iis active-directory ldap directoryservices