使用LDAP连接时出现以下错误
Connection.freeWriteSemaphore(-2):信号量不归任何线程所有 我使用以下代码
public static bool Authenticate(string userName, string password)
{
//logger.Debug("Try to connect to LDAP to authenticate user with " + userName + "/***");
string uDN = ldapUserDN.Replace("$UID", userName);
bool flag = false;
LdapConnection ldapConn = new LdapConnection();
try
{
ldapConn.Connect(ldapServer, int.Parse(ldapServerPort));
ldapConn.Bind(uDN, password);
flag = ldapConn.Bound;
}
catch (Exception ex)
{
//logger.Error("Exception in Authenticate():", ex);
}
finally
{
ldapConn.Disconnect();
}
return flag;
}