C#:LDAP服务器不可用 [英] C#: The LDAP server is unavailable

查看:313
本文介绍了C#:LDAP服务器不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public override ActionResult Auth(FormCollection form, string returnUrl = "/")
        {
            try
            { 
                bool auth = LogicLogin();
                if (auth)                
                    return this.RedirectLogged();

                ViewBag.Error = "Usuario o password invalido.";
                return View();
            }
            catch (Exception ex) //here i am getting that exception
            {
                ViewBag.Error = ex.Message;
                return View();
            }
            
        }

protected override bool LogicLogin()
        {
            
          
            bool result = this.ValidateFromDomain(GetServerAdress(),this.GetData("userName"),this.GetData("password"));
            if (result)
            {
                this.AuthenticationSetAuthCookie(this.GetData("userName"));
                this.SetSession(ServiceLoginController.userNameSession, this.GetData("userName"));
            }
            return result;
        }





我在活动目录登录期间收到异常:





I am getting an exception during active directory login:

Inner Exception:The LDAP server is unavailable.
Message:The server could not be contacted.
Source: System.DirectoryServices.AccountManagement







如果有人有意,请帮助。




If anyone have idea please help.

推荐答案

显然你的LDAP服务器存在连接问题。

我要检查的第一件事是这个服务器实际上是可以访问的。



您可以在此Wiki页面上找到用于访问LDAP目录的列表软件 [ ^ ]



首先尝试使用其中一个连接到LDAP服务器,验证它是否可访问,并且您拥有正确的身份验证信息。

然后返回到您的代码,并调试尝试找到为什么无法从你的代码中找到它。



这就是所有可以说的,因为你提供的代码没有提供相关方法的内容蚂蚁问题。
Obviously there is a connection problem to your LDAP server.
First thing I would check is this server is actually reachable.

You can find a list softwares to access an LDAP directory on this Wiki page[^]

First try to connect to your LDAP server with one of them, validate it is reachable and you have the correct authentication information for that.
Then go back to your code, and debugging try to find why it isn't reachable from your code.

This is all that can be said as the code you provided does not present the content of methods relevant to the problem.


除连接问题外,可能存在密码过期的情况。更改密码并尝试。还要执行以下步骤:



您可以运行以下命令来更新系统上的组策略。

GoTo RUN - >键入cmd - >以管理员身份运行。在控制台上,输入gpUpdate然后输入然后输入ipconfig / flushdns并输入。



一切顺利: - )
Apart from connection issue, there might be a case where your password is expired. Change your password and try. Also perform following steps:

You can run following command to update the group policy on your system.
GoTo RUN --> type cmd --> run as Administrator. On the console, type gpUpdate and enter and then ipconfig /flushdns and enter.

All the best :-)


这篇关于C#:LDAP服务器不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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