2016-07-14 60 views
1

我已经在Windows Azure中使用下面的教程配置安全LDAP:用的DirectoryEntry Azure的LDAP“的服务器不可操作”的错误C#

https://azure.microsoft.com/en-us/documentation/articles/active-directory-ds-admin-guide-configure-secure-ldap/

但我得到“的服务器不可操作”错误。我尝试使用下面的代码:

string DomainPath = "LDAP://0.0.0.0:636"; 
DirectoryEntry searchRoot = new DirectoryEntry(DomainPath, "[email protected]", "password", AuthenticationTypes.Secure); 
DirectorySearcher search = new DirectorySearcher(searchRoot); 
search.Filter = "(&(objectClass=user)(objectCategory=person))"; 
search.PropertiesToLoad.Add("samaccountname"); 
search.PropertiesToLoad.Add("mail"); 
search.PropertiesToLoad.Add("usergroup"); 
search.PropertiesToLoad.Add("displayname");//first name 
SearchResult result; 
SearchResultCollection resultCol = search.FindAll(); 
if (resultCol != null) 
{ 
    for (int counter = 0; counter < resultCol.Count; counter++) 
    { 
     string UserNameEmailString = string.Empty; 
     result = resultCol[counter]; 
     if (result.Properties.Contains("samaccountname") && result.Properties.Contains("mail") && 
           result.Properties.Contains("displayname")) 
     { 
      Users objSurveyUsers = new Users(); 
      objSurveyUsers.Email = (String)result.Properties["mail"][0] + 
            "^" + (String)result.Properties["displayname"][0]; 
      objSurveyUsers.UserName = (String)result.Properties["samaccountname"][0]; 
      objSurveyUsers.DisplayName = (String)result.Properties["displayname"][0]; 
      lstADUsers.Add(objSurveyUsers); 
     } 
    } 
} 

我也曾试图连接我的IP和软件LDP.EXE它也给错误域连接失败。

我的问题是,我可以在Azure平台上使用DirectoryEntry来获取用户吗?

如果不是这样的话,那么Azure中LDAP的用途是什么?

由于提前

+0

你解决了这个问题吗?我也有同样的问题。如果你解决了它,请分享我的信息。 LDAP在Azure中的用途是什么? – Rango

回答