.Net's Directory Services throws a strange exception

后端 未结 4 1696
孤城傲影
孤城傲影 2020-12-03 20:52

I have a small C# solution used to check users credentials. It works fine for two of my teammates, but on my PC I get an exception.

The relevant code:



        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 21:17

    Perhaps you need the hotfix?

    • FIX: DirectoryOperationException exception

    And you are an Admin or the id that your service is running under is an Admin on your PC right?

    I take it you already looked into this:

    • System.DirectoryServices.Protocols

    "You may receive a less than helpful DirectoryOperationException(“The server cannot handle directory requests.”) what isn’t quite so amusing about this is that it didn’t even try to communicate with the server. The solution was to add the port number to the server. So instead of passing “Server” to open the LdapConnection, I passed “server:636”. By the way, LDAPS is port 636 – rather than the 389 port used by LDAP."


    Good point, I wouldn't expect that Win7/.NET 3.5 would need that patch. How about the info provided in this question:

    • Setting user's password via System.DirectoryServices.Protocols in AD 2008 R2

提交回复
热议问题