我有一个关于在C#中的Active Directory类的问题。 在我的节目一个时刻,我试图让当前域用户登录使用下面的命令:
Domain.GetCurrentDomain();
大多数时候,它的工作原理。 但是,从无线笔记本电脑运行时,它给了我下面的错误:
System.DirectoryServices.ActiveDirectory.ActiveDirectoryServerDownException: The server is not operational.
Name: "DOMAIN.ca"
---> System.Runtime.InteropServices.COMException: The server is not operational.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
at System.DirectoryServices.ActiveDirectory.PropertyManager.GetPropertyValue(DirectoryContext context, DirectoryEntry directoryEntry, String propertyName)
--- End of inner exception stack trace ---
at System.DirectoryServices.ActiveDirectory.PropertyManager.GetPropertyValue(DirectoryContext context, DirectoryEntry directoryEntry, String propertyName)
at System.DirectoryServices.ActiveDirectory.Domain.GetDomain(DirectoryContext context)
at System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain()
at ADT.ADTools.ComputerIsInDomain()
在我的具体情况,这段代码应该记录在Active Directory帐户的任何帐户的工作,无论它正在运行的计算机,或者如果计算机连接到使用无线或有线连接的域。
请问你们谁知道这个问题的答案或问题,我可以做些什么来使它工作的任何变通办法?