COMException"未注册库。"在使用System.DirectoryServices时

时间:2020-03-05 18:44:56  来源:igfitidea点击:

我刚刚开始在Windows 2000的.NET 2框架下的Windows窗体应用程序中使用" System.DirectoryServices"时收到以下错误。

{System.Runtime.InteropServices.COMException}
System.Runtime.InteropServices.COMException: {"Library not registered."}
_className: Nothing
_COMPlusExceptionCode: -532459699
_data: Nothing
_dynamicMethods: Nothing
_exceptionMethod: Nothing
_exceptionMethodString: Nothing
_helpURL: Nothing
_HResult: -2147319779
_innerException: Nothing
_message: "Library not registered."
_remoteStackIndex: 0
_remoteStackTraceString: Nothing
_source: Nothing
_stackTrace: {System.Array}
_stackTraceString: Nothing
_xcode: -532459699
_xptrs: 0
Source: "System.DirectoryServices"
StackTrace: "   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) 
  at System.DirectoryServices.DirectoryEntry.Bind()
  at System.DirectoryServices.DirectoryEntry.get_AdsObject()
  at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
  at System.DirectoryServices.DirectorySearcher.FindAll()

我已经重新安装了框架并重新注册了" activeds.dll",但这仍未解决问题。我猜我需要找到另一个dll并重新注册它,但尚不清楚这将是哪个dll。

解决方案

回答

使用Reflector快速了解Directory Services代码后,Active Directory Service Interfaces安装看起来可能像是kaput。

我们可以从Technet下载2.5版,尽管我不确定它是最新版本还是可以在Windows 2000中使用。