COMException “Library not registered.” while using

2019-08-03 03:47发布

问题:

I have only just started received the following error in my windows forms application under .NET 2 framework on windows 2000 when using 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()

I have re-installed the framework and re-registered activeds.dll however this has not resolved the issue. I am guessing I need to find another dll and re-register it however it is not clear which dll this would be.

回答1:

Having used Reflector to have a quick peak at the Directory Services code, it looks like your Active Directory Service Interfaces installation might be kaput.

You can download version 2.5 from Technet although I'm not sure if it's the latest version or if it works with Windows 2000.