繁体   English   中英

LDAPS在Visual Studio 2008上有效,但在IIS 5.1上无效

[英]LDAPS works on Visual Studio 2008 but does not work on IIS 5.1

我正在使用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.BindHelper(NetworkCredential newCredential,Boolean needSetCredential)的System.DirectoryServices.Protocols.LdapConnection.Connect()在Jonahgroup.Lychee.Security。 .AuthenticateUser(字符串userName,字符串密码)

应该注意的是,如果我在没有SSL的情况下运行代码,则在IIS和VS上都可以正常工作。

任何帮助,将不胜感激。

IIS帐户无权访问证书存储。 您可以更改IIS帐户以自己的身份运行(不建议用于生产部署),也可以授予当前IIS帐户对每个证书的访问权限(在c:\\ Documents and Settings \\ All Users \\ Application Data \\ Microsoft \\ Crypto \\下RSA)。

偶然地,我发现了一个类似的线程,其中作者能够从IUSR_帐户切换IIS帐户以使用ASPNET。

http://www.velocityreviews.com/forums/t109404-aspnet-and-ldap.html

应该注意的是,如果我在没有SSL的情况下运行代码,则在IIS和VS上都可以正常工作。

这意味着问题与ssl配置的关系比其他任何问题都重要,尽管尚不清楚为什么要在Windows xp(iis 5.1)(这是台式机级系统,而不是Windows服务器版本)上运行此问题。

暂无
暂无

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

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