当前安全上下文与活动目录域或林无关 [英] Current security context is not associated with an active directory domain or forest
问题描述
我想获取网络上可用的域名列表。它在我的本地桌面上运行完美。但在部署时,发生以下错误:
当前安全上下文与活动目录域或林无关。
任何帮助?
以下是我使用的代码:
列表与LT;串GT; DomainList = new List< string>();
var forest = Forest.GetCurrentForest();
foreach (域名dm 在 forest.Domains中)
{
DomainList.Add(dm.Name);
}
提前致谢!
< blockquote class =FQ>Pete O'Hanlon写道:您遇到的部分问题是您的IIS帐户可能不会作为域帐户运行。有关要做的事情的更多信息,请查看此主题: http://directoryprogramming.net/forums/thread/1103。 aspx [ ^ ]
I want to get the list of domains available on the network. It runs perfectly on my local desktop. But upon deploying, the following error occurred:
Current security context is not associated with an active directory domain or forest.
Any help?
Here is the code i used:
List<string> DomainList = new List<string>();
var forest = Forest.GetCurrentForest();
foreach (Domain dm in forest.Domains)
{
DomainList.Add(dm.Name);
}
Thanks in advance!
Pete O'Hanlon wrote:Part of the problem you are having here is that your IIS account will probably not be running as a domain account. Have a look at this thread for more information of things to do: http://directoryprogramming.net/forums/thread/1103.aspx[^]
这篇关于当前安全上下文与活动目录域或林无关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!