2016-07-14 57 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

回答