我使用.Net帳戶管理庫訪問Active Directory以搜索當前http請求用戶的詳細信息。 我的應用程序池使用自定義帳戶運行,它也來自同一個域。服務器和用戶也屬於同一個域。來自Active Directory的間歇性未知錯誤
public string GetEmployeeId(string SAMAccountName)
{
using (PrincipalContext domainContext = new PrincipalContext(ContextType.Domain))
{
using (UserPrincipal userprincipal = new UserPrincipal(domainContext))
{
userprincipal.SamAccountName = SAMAccountName;
using (PrincipalSearcher ps = new PrincipalSearcher())
{
ps.QueryFilter = userprincipal;
UserPrincipal user = ps.FindOne() as UserPrincipal;
return user.EmployeeId;
}
}
}
}
安裝工程完美但間歇我得到下面的錯誤從AD.after有時它的工作原理爲相同的用戶沒有任何錯誤。
是否有任何方法檢查AD側的日誌/事件以找出此錯誤的原因。
System.Runtime.InteropServices.COMException(0x80005000):未知的錯誤>(0x80005000)
https://support.microsoft.com/en-gb/kb/324433 – Ashigore
感謝您的評論先生。但據我瞭解,這個服務器問題是在2000年,我們的版本是2012年。 –
我有同樣的問題,但它不會立即發生。一旦發生這種情況,它將保持這種狀態,直到我手動回收應用程序池爲止。 – icedek