错误:服务器无法运行. [英] Error: The Server is not operation.
本文介绍了错误:服务器无法运行.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在应用程序中使用窗口身份验证.这是从域名(retail.abg.com)访问所有组的一些要求, IP地址是10.557.847.55.
我正在使用轻量级目录访问协议.我的代码抛出错误,例如
我的代码如下.
Hi,
I am using window authentication in application. Here is some requirement to access all groups from domain name(retail.abg.com), & IP address is 10.557.847.55.
I am using light weight directory access protocol. my code throw error like
my code is given below.
public List<string> ListGroups()
{
List<string> grp = new List<string>();
string LDAP = "LDAP://";
DirectoryEntry objADAM = default(DirectoryEntry);
DirectoryEntry objGroupEntry = default(DirectoryEntry);
DirectorySearcher objSearchADAM = default(DirectorySearcher);
SearchResultCollection objSearchResults = default(SearchResultCollection);
SearchResult myResult = null;
try
{
objADAM = new DirectoryEntry(LDAP + "retail.abg.com");
objADAM.RefreshCache();
objSearchADAM = new DirectorySearcher(objADAM);
objSearchADAM.Filter = "(&(objectClass=group))";
objSearchADAM.SearchScope = SearchScope.Subtree;
objSearchResults = objSearchADAM.FindAll();
// Enumerate groups
//fileGroups.AutoFlush = true;
if (objSearchResults.Count != 0)
{
foreach (SearchResult objResult in objSearchResults)
{
myResult = objResult;
objGroupEntry = objResult.GetDirectoryEntry();
grp.Add(objGroupEntry.Name);
}
}
else
{
throw new Exception("No groups found");
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
return grp;
}
请帮助
谢谢
Ganu
please help
Thanks
Ganu
推荐答案
看看是否有帮助
使用Microsoft .NET Framework库查询Microsoft Active Directory [ ^ ]
希望对您有所帮助.
See if this helps
Querying Microsoft Active Directory Using Microsoft .NET Framework Library[^]
Hope it helps.
UserPrincipal current_user = UserPrincipal.Current;
PrincipalContext current_context = current_user.Context;
PrincipalContext ctx = new PrincipalContext(ContextType.Machine, "10.200.202.89");
GroupPrincipal qbeUser = new GroupPrincipal(ctx);
Principal userOrGroup = qbeUser as Principal;
userOrGroup.Name = "*";
PrincipalSearcher searcher = new PrincipalSearcher(userOrGroup);
List<string> AllGroups = new List<string>();
foreach (Principal found in searcher.FindAll())
{
if (found is GroupPrincipal)
{
AllGroups.Add(found.Name);
}
}
return AllGroups;
}</string></string>
这篇关于错误:服务器无法运行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文