【发布时间】:2009-06-12 14:10:28
【问题描述】:
我正在使用 C# 对我的应用程序的用户进行身份验证,如下所示:
LdapConnection connection = null;
try
{
using (connection = new LdapConnection(Configuration.JonahLdapServer))
{
connection.Credential = new NetworkCredential(userName, password, Configuration.JonahDomain);
connection.AuthType = AuthType.Basic;
connection.SessionOptions.SecureSocketLayer = true;
connection.SessionOptions.VerifyServerCertificate =
new VerifyServerCertificateCallback(AlwaysTrustCertificateDelegate);
connection.Bind();
return true;
}
}
当我在 VS 2008 中运行它时,它工作得很好。但是,当我将应用程序部署到 IIS 5.1 时,它给了我以下堆栈跟踪:
System.DirectoryServices.Protocols.LdapException:LDAP 服务器不可用。 System.DirectoryServices.Protocols.LdapConnection.Connect() 在 System.DirectoryServices.Protocols.LdapConnection.BindHelper(NetworkCredential newCredential,布尔需要SetCredential) 在 System.DirectoryServices.Protocols.LdapConnection.Bind() 在 Jonahgroup.Lychee.Presentation.Security.SecurityManager.AuthenticateUser(String userName, String password)
应该注意的是,如果我在没有 SSL 的情况下运行代码,它在 IIS 和 VS 上都可以正常工作。
任何帮助将不胜感激。
【问题讨论】:
标签: c# visual-studio iis ldap