【问题标题】:Intermittent unknown error from Active Directory来自 Active Directory 的间歇性未知错误
【发布时间】:2016-03-28 09:51:45
【问题描述】:

我正在使用 .Net 帐户管理库访问 Active Directory 以搜索当前 http 请求用户的详细信息。 我的应用程序池使用自定义帐户运行,它也来自同一个域。服务器和用户也属于同一个域。

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收到以下错误。有时它适用于同一用户没有任何错误。 p>

有什么方法可以从 AD 端检查日志/事件来找出这个错误的原因。

System.Runtime.InteropServices.COMException (0x80005000):未知错误 >(0x80005000)

【问题讨论】:

  • 感谢先生的评论。但据我了解,这个服务器问题是在 2000 年,我们的版本是 2012 年。
  • 我有同样的问题,但它不会立即发生。一旦它发生,它就会一直保持这种状态,直到我手动去回收应用程序池。
  • 我也有同样的问题,就像icedek一旦发生,它就会卡住,直到我手动回收应用程序池。

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


【解决方案1】:

我与 Microsoft 工程师合作了很长时间来解决此问题,因此希望我的解决方案可以帮助其他人解决他们的问题。

首先,错误代码 0x80005000 引用了无效的 ADSI 路径名,这并不是特别有用。

我们做了很多追踪,但也不是很有帮助。我们做的最后一件事是使用进程监视器来跟踪注册表。

当错误发生时,我注意到发生了一个 HIVE UNLOADED 结果(见截图)

基于此,我们在事件日志中也发现了这个错误。

Log Name:      Application 
Source:        Microsoft-Windows-User Profiles Service 
Date:          10/26/2009 8:22:13 AM 
Event ID:      1530 
Task Category: None 
Level:         Warning 
Keywords:      Classic 
User:          SYSTEM 
Computer:      SERVERNAME 
Description: 
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.  
DETAIL - 
1 user registry handles leaked from \Registry\User\S-1-5-21-1049297961-3057247634-349289542-1004_Classes: 
Process 2428 (\Device\HarddiskVolume1\Windows\System32\dllhost.exe) has opened key \REGISTRY\USER\S-1-5-21-1123456789-3057247634-349289542-1004_CLASSES

工程师推荐这篇文章https://support.microsoft.com/en-us/help/2287297/a-com-application-may-stop-working-on-windows-server-2008-when-a-user

这似乎解决了我的问题。

【讨论】:

    【解决方案2】:

    尝试确定您将使用的域服务器:

    类似: = new PrincipalContext(ContextType.Domain, "YOURADDOMAIN");

    【讨论】:

    • 感谢先生的回复。我的服务器、应用程序池和客户端用户都来自同一个域。此代码有效,但有时客户端会收到此错误,后来它对相同的客户端完美运行。我认为这个错误来自 AD 方面。
    猜你喜欢
    • 2013-11-28
    • 2021-12-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    • 2016-12-09
    • 1970-01-01
    相关资源
    最近更新 更多