首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >故障排除帮助: Active Directory绑定失败

故障排除帮助: Active Directory绑定失败
EN

Stack Overflow用户
提问于 2010-07-01 01:50:46
回答 1查看 1.4K关注 0票数 0

我正在尝试诊断客户端站点上运行的服务器应用程序的问题。所述应用根据AD环境中的域控制器对用户凭证进行认证。我们看到的行为是周期性地没有用户可以通过服务器进行身份验证。

我们基本上已经将失败追溯到“绑定”失败。为了进一步诊断这个问题,我构建了一个超级简单的工具,它执行两种类型的绑定:一种使用LDAP服务器绑定,另一种使用WinNT绑定。我们的服务器应用程序只执行LDAP绑定,但是为了添加一个控件,我抛出了WinNT绑定。

代码语言:javascript
复制
        public static void DoWinNTBind(string domain, string login, string password)
        {
            Logger.Log("Starting WinNT Bind to {0}",domain);
            try
            {
                var serverPath = String.Format("WinNT://{0}",domain);

                Logger.Log("Creating DirectoryEntry object for {0} on domain {1}", login, serverPath);
                using (DirectoryEntry de = new DirectoryEntry(serverPath, login, password, AuthenticationTypes.Secure | AuthenticationTypes.Sealing))
                {

                    if (!de.NativeObject.Equals(null))
                    {
                        Logger.Log("WinNT Bind Success");
                    }
                    else
                    {
                        Logger.Log("WinNT Bind Failed");
                    }
                }
            }
            catch(Exception ex)
            {
                Logger.Log("{0} occured during WinNT Bind: {1}",ex.GetType().Name,ex.Message);
                Logger.Log("Stack: {0}",ex.StackTrace);
            }
        }

        public static void DoLDAPBind(string domain,string login, string password) 
        {
            Logger.Log("Starting LDAP Bind to {0}",domain);
            try
            {
                var serverPath = String.Format("LDAP://{0}",domain);

                Logger.Log("Creating DirectoryEntry object for {0} on domain {1}", login, serverPath);
                using (DirectoryEntry de = new DirectoryEntry(serverPath, login, password, AuthenticationTypes.Secure | AuthenticationTypes.Sealing))
                {

                    if (!de.NativeObject.Equals(null))
                    {
                        Logger.Log("LDAP Bind Success");
                    }
                    else
                    {
                        Logger.Log("LDAP Bind Failed");
                    }
                }
            }
            catch(Exception ex)
            {
                Logger.Log("{0} occured during LDAP Bind: {1}",ex.GetType().Name,ex.Message);
                Logger.Log("Stack: {0}",ex.StackTrace);
            }
        }

正如您所看到的,除了使用System.DirectoryServices.DirectoryEntry连接到DC之外,没有太多的代码。

生成的日志文件是(名称和域掩码)。

6/29/2010 2:52:17 PM:正在为user1执行AD绑定2:52:17 PM:正在启动到xxx.xxx的LDAP绑定6/29/2010 2:52:17 PM:正在为域LDAP://xxx.xxx 6/29/2010 2:52:17 PM创建DirectoryEntry对象: LDAP绑定过程中出现DirectoryServicesCOMException :登录失败:未知用户名或密码错误。

6/29/2010 2:52:17 PM: Stack: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.get_NativeObject() at AdmitOne.Superglue.ActiveDirectoryHelper.DoLDAPBind(String domain,String throwIfFail,字符串密码) in C:\Projects\Galapagos\branches\Contract\2.0_SN_Peer\Src\Tools\Superglue\ActiveDirectoryHelper.cs:line 47 6/29/2010 2:52:17 PM: Starting WinNT Bind to xxx.xxx 6/29/2010 2:52:17 PM: Creating DirectoryEntry object for user1 on domain WinNT://xxx.xxx 6/29/2010 2:52:18 PM: WinNT Bind Success

因此,同一个用户名使用LDAP绑定失败,但使用WinNT成功绑定!

在我们的本地测试环境中,我们没有看到这种行为,LDAP和WinNT都成功了,没有任何问题。

所以我被卡住了。我想说这是他们的广告环境的一个问题,但没有确凿的证据,我做不到。

我首先询问Stack,以确保我的绑定代码是正确的。在此之后,我可能需要重新考虑Serverfault,这是询问AD特定问题的更合适位置。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-07-01 05:26:54

事实证明这不是代码问题,而是客户的AD环境与Kerberos有问题。

具体地说,安全/密封标志指示LDAP提供者仅使用Kerberos来安全地协商身份验证。

由于WinNT提供程序不支持Kerberos,因此与Kerberos提供程序的绑定不存在问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3151946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档