问题
When I'm trying to connect to an AD in my computer network by writing the following line:
DirectoryEntry de = new DirectoryEntry("LDAP://hostname.local");
I get the following error:
Logon failure: unknown user name or bad password
But when I'm trying to connect to the same computer using its IP I'm able to reach the computer without an error, that is the following line does work:
DirectoryEntry de = new DirectoryEntry("LDAP://The IP of hostname.local");
How is it possible that when I'm trying to use the ldap query with hostname I'm getting Logon failure but when I'm using the host name ip address I reach the computer successfully and able to view its AD contents.
来源:https://stackoverflow.com/questions/27645317/ldap-directoryentry-unable-to-connect-via-hostname-but-only-via-ip-address