在asp.net MVC應用程序中,當使用directoryEntry.Invoke
嘗試重置密碼時,遇到訪問被拒絕錯誤。DirectoryEntry SetPassword方法返回拒絕訪問異常
用戶試圖更改他/她的密碼訪問該頁面,並且在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>
- 該應用池是一個廣告帳戶下運行;也是當地的一部分 管理組
[Domain1\AppPoolUser]
。 - 應用程序請求用戶證書
- 嘗試更改密碼
[Domain2\testUser]
的用戶以及運行應用程序池的帳戶位於不同的域中,但這不可能是問題。對於AppPoolUser的有效權限允許testUser帳戶上的ChangePassword。 - 我甚至嘗試在與 測試帳戶相同的用戶帳戶下運行應用程序池,但它不會改變任何內容。
已經在網上查過,但是不清楚這個問題可能是什麼。我看到的最相關的事情是這樣的 - Setting ASP.Net Permissions - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
但是,正如我所提到的,應用程序池在有限的技術帳戶下運行,我認爲SSL證書沒有任何問題。
- 我是否需要爲AD中的應用程序池帳戶請求控制權委派?
- 或者有可能是我錯過了另一個問題。