本地Windows 7上的活动目录 [英] Active directory on a local windows 7
问题描述
您好。
我正在开发一个ASP.NET网站。其功能之一是使用活动目录进行身份验证。在开发时,(现在)我无法使用服务器计算机访问网络。所以我需要在我的Windows 7终极上工作。我从微软下载了活动目录。
当我尝试使用ldap地址登录我的网站时,我收到此错误:
Hello.
I am developing an ASP.NET website. One of its features is authenticating using active directory. At developing time, (right now) i have no access to network with a server computer. So i need to work on my windows 7 ultimate. I downloaded active directory stuffs from microsoft.
When i try to logon my website with ldap address, i get this error:
The specified domain either does not exist or could not be contacted.
要使用LDAP地址,我需要将我的Windows加入域名,对吧?
好的,但我的计算机未连接到任何网络或服务器计算机。我可以为本地计算机定义域吗?怎么回事?
或者我想尝试以错误的方式登录。这是我的代码
To use LDAP address, i need to my windows joined to a domain, Right?
Ok, but my computer is not connected to any network or server computer. Can i define a domain for local computer? How is it?
Or maybe i am trying to login in wrong way. this is my code
bool authenticated = false;
try
{
string server = "LDAP://real.domain.com";
DirectoryEntry entry = new DirectoryEntry(server, Environment.UserDomainName + "\\" + user, password);
/* DirectoryEntry entry = new DirectoryEntry("LDAP://"+ Environment.UserDomainName ,user, password);
*/ //DirectoryEntry entry = new DirectoryEntry(server, user, password);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException cex)
{
//not authenticated; reason why is in cex
}
catch (Exception ex)
{
//not authenticated due to some other exception [this is optional]
}
return authenticated;
DirectoryEntry初始化时的代码抛出异常。
谢谢!!!
AH
The code throw exception at DirectoryEntry initializing.
Thank you!!!
A.H
推荐答案
无法安装域控制器在本地(桌面)Windows上...
您必须创建一个运行域控制器的虚拟机...
Microsoft预安装虚拟机机器在这里,您可以用于此类测试: http://www.microsoft.com /en-us/download/details.aspx?id=2227 [ ^ ]
There is no way to install domain controller on your local (desktop) Windows...
You will have to create a virtual machine, that runs a domain controller...
Microsoft has a pre-installed virtual machine here, that you can use for such testing: http://www.microsoft.com/en-us/download/details.aspx?id=2227[^]
这篇关于本地Windows 7上的活动目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!