简体   繁体   English

LDAPS与ASP.Net/C#的连接

[英]LDAPS connection with ASP.Net/C#

I have a connection string for LDAP protocol 我有LDAP协议的连接字符串

ldap://ldap.example.com:636/DC=users,DC=buyers LDAP://ldap.example.com:636 / DC =用户,DC =买家

which works fine. 效果很好。

But I need to use a LDAPS connection : 但是我需要使用LDAPS连接:

ldaps://ldap.example.com/DC=users,DC=buyers LDAPS://ldap.example.com/DC=users,DC=buyers

which does show up in ldp.exe windows form when I test the connection. 当我测试连接时,它确实以ldp.exe Windows窗体显示。

Unfotunately it does not work in the Asp.Net application. 不幸的是,它在Asp.Net应用程序中不起作用。 I get "Unknown error (0x80005000)". 我收到“未知错误(0x80005000)”。

I am not sure whether LDAPS string is even possible with Asp.Net. 我不确定Asp.Net是否可以使用LDAPS字符串。 I downloaded the source code into LDAPConnection.cs class and was unable to find any valuable information. 我将源代码下载到LDAPConnection.cs类中,但是找不到任何有价值的信息。

The method you found that works is indeed using LDAPS: 您发现有效的方法确实是使用LDAPS:

ldap://ldap.example.com:636/DC=users,DC=buyers

That's the only way to do it. 那是唯一的方法。 I do that in one of my existing projects. 我在现有项目之一中做到了这一点。 It doesn't understand "LDAPS://". 它不理解“ LDAPS://”。

If you don't believe me :) fire up Wireshark as you debug. 如果您不相信我,:)在调试时启动Wireshark。 When it connects, you'll see the SSL handshake to your domain controller. 连接后,您会看到与域控制器的SSL握手。

Port 636 is only for LDAPS. 端口636 用于LDAPS。 Port 389 is the non-SSL port. 端口389是非SSL端口。

If you have more than one domain, you can use port 3269 for the global catalog via SSL. 如果您有多个域,则可以通过SSL将端口3269用于全局目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM