当前安全上下文与活动目录域或林无关 [英] Current security context is not associated with an active directory domain or forest

查看:718
本文介绍了当前安全上下文与活动目录域或林无关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取网络上可用的域名列表。它在我的本地桌面上运行完美。但在部署时,发生以下错误:



当前安全上下文与活动目录域或林无关。



任何帮助?



以下是我使用的代码:

列表与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[^]


Source[^]


这篇关于当前安全上下文与活动目录域或林无关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆