LDAP身份验证.net提供异常“服务器无法运行” [英] LDAP Authentication .net giving exception "The server is not operational"

查看:210
本文介绍了LDAP身份验证.net提供异常“服务器无法运行”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在下面有一个代码来连接ldap服务器,但它给了我以下例外。



  private   void  btnLogin_Click( object  sender,EventArgs e)
{
string strUsername,strPassword,strDomain;
strUsername = txtUsername.Text;
strPassword = txtPassword.Text;
strDomain = txtDomain.Text;
if (strUsername ==
MessageBox.Show( 输入用户名);
else if (strPassword ==
MessageBox.Show( 输入密码);
else if (strDomain ==
MessageBox.Show( 输入域名);
else
{
strDomain = LDAP:// + strDomain;
使用(DirectoryEntry deDirEntry = new DirectoryEntry(strDomain,
strUsername,
strPassword,AuthenticationTypes.Secure))
{
// 如果用户已经过验证,那么欢迎
尝试
{
MessageBox.Show( 欢迎使用' + deDirEntry.Name + );

// TODO:在此处添加您的特定任务
}
catch (Exception exp)
{
MessageBox.Show( 抱歉,无法验证您的信息 + exp);
}
}
}
}





以下是我得到的例外。



 System.Runtime.InteropServices.COMException(0x8007203A):服务器 无效。 System.DirectoryServices.DirectoryEntry.Bind上的

Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
在System.DirectoryServices.DirectoryEntry.get_Name()
at ldap.frmLdap.btnLogin_Click( Object sender,EventArgs e) C:\Documents and Settings \divyar.DNISC \ my documents \visual studio 2010 \Projects \ oldap\ldap \ frmLdap.cs:line 41







i认为它已经连接但没有绑定?怎么解决这个?在此先感谢

解决方案

请检查此服务器不可操作

Hi all,
I have a code below to connect ldap server but its giving me the following exception.

private void btnLogin_Click(object sender, EventArgs e)
      {
          string strUsername, strPassword, strDomain;
          strUsername = txtUsername.Text;
          strPassword = txtPassword.Text;
          strDomain = txtDomain.Text;
          if (strUsername == "")
              MessageBox.Show("Enter Username");
          else if (strPassword == "")
              MessageBox.Show("Enter Password");
          else if (strDomain == "")
              MessageBox.Show("Enter Domain");
          else
          {
              strDomain = "LDAP://" + strDomain;
              using (DirectoryEntry deDirEntry = new DirectoryEntry(strDomain,
                                                        strUsername,
                                                         strPassword, AuthenticationTypes.Secure))
              {
                  // if user is verified then it will welcome then
                  try
                  {
                      MessageBox.Show("Welcome to '" + deDirEntry.Name + "'");

                      // TODO: add your specific tasks here
                  }
                  catch (Exception exp)
                  {
                      MessageBox.Show("Sorry, unable to verify your information"+exp);
                  }
              }
          }
      }



And below is the exception i am getting.

System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational.

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_Name()
   at ldap.frmLdap.btnLogin_Click(Object sender, EventArgs e) in C:\Documents and Settings\divyar.DNISC\my documents\visual studio 2010\Projects\ldap\ldap\frmLdap.cs:line 41




i think its getting connected but not getting bind? how to solve this? Thanks in advance

解决方案

Please Check this The Server Is Not Operational


这篇关于LDAP身份验证.net提供异常“服务器无法运行”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆