来自Active Directory的间歇性未知错误 [英] Intermittent unknown error from Active Directory
问题描述
我正在使用.Net帐户管理库访问Active Directory,以搜索当前http请求用户的详细信息。
我的应用程序池使用自定义帐户运行,该帐户也来自同一域。服务器和用户也属于同一域。
I'm using .Net account management libraries to access Active Directory to search the details of current http request user. My app pool runs with custom account and it also from the same domain. Server and users also belong to same domain.
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中获得以下错误。一段时间后,它可以为同一用户使用而没有任何错误。
Setup works perfectly but intermittently i get below error from AD.after sometime it works for the same user without any error.
是否有任何方法可以从AD端检查日志/事件以查找此错误的原因。
Is there any way to check logs / events from the AD side to find the reason for this error.
System.Runtime.InteropServices.COMException(0x80005000):未知错误>(0x80005000)
System.Runtime.InteropServices.COMException (0x80005000): Unknown error >(0x80005000)
推荐答案
我与Microsoft工程师合作了很长时间,以解决此问题,因此希望我的解决方案可以帮助其他人解决他们的问题。
I worked with a Microsoft Engineer for a long time to fix this so hopefully my solution can help others fix their problems.
首先将错误代码0x80005000引荐给传递了无效的ADSI路径名,这并不是特别有用。
First off the error code 0x80005000 referrers to an invalid ADSI pathname was passed, which wasn’t particularly helpfully.
我们做了很多跟踪,但也没有太大帮助。我们所做的最后一件事是使用Process Monitor跟踪注册表。
We did a lot of tracing which was also not very helpful. Last thing we did was use Process Monitor to trace the Registry.
发生错误时,我注意到发生了HIVE UNLOADED结果(请参见屏幕截图)
When the error occurred, I noticed a HIVE UNLOADED result happened (see screenshot)
基于此,我们还发现此错误出现在事件日志中。
Based on this we also found this error appearing in the event log.
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
这似乎可以解决我的问题。
Which seem to fix my problem.
这篇关于来自Active Directory的间歇性未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!