none
DirectoryEntity failed to bind to AD LDS RRS feed

  • 问题

  • I have a AD LDS instance on port 50000, and add another Acitive Direcotry user Administrator to the instance Administrators role. The proxy authentication has been configured, and tested with ADSI Edit and LDP tool.

    In ADSI Edit, I connect to AD LDS instance with "Specifiy Credntials" option checked, after input the Active Directory user and password, it connected successsfully!

    In LDP, I bind to the server with Bind type Bind with Credentials checked, and it also bind successfully!

    All the two test means the AD LDS instanced confiugred corectly!

    But when I try to bind with DirectoryEntry class, I always got a System.Runtime.InteropServices.COMException was unhandled error, fowllowing is the code and exception:

                var directory = new DirectoryEntry("ldap://clean13:50000/CN=instance,CD=myAD,DC=com",
                    "myAD\\administrator",
                    "abc123,./",
                    AuthenticationTypes.Secure
                    //| AuthenticationTypes.Sealing
                    //| AuthenticationTypes.Signing
                    | AuthenticationTypes.Delegation
                    );
                var nativeObj = directory.NativeObject;

    System.Runtime.InteropServices.COMException was unhandled
      ErrorCode=-2147463168
      HResult=-2147463168
      Message=Unknown error (0x80005000)
      Source=System.DirectoryServices
      StackTrace:
           at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
           at System.DirectoryServices.DirectoryEntry.Bind()
           at System.DirectoryServices.DirectoryEntry.get_NativeObject()
           at ConsoleApplication1.Program.Test() in C:\Users\Administrator\documents\visual studio 2015\Projects\WindowsFormsApplication1\ConsoleApplication1\Program.cs:line 48
           at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Administrator\documents\visual studio 2015\Projects\WindowsFormsApplication1\ConsoleApplication1\Program.cs:line 33
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    I infer maybe I specified the wrong AuthenticationTypes, but after so many tests, I cann't find which AuthenticationTypes are correct, anybody can help me?


    Yungfu

    2019年5月22日 6:28

全部回复