ActiveDirectoryServerDownException在无线网络上获取当前的域时,无线网络、ActiveDirectoryServerDownException

2023-09-08 13:08:56 作者:我对着你捂着心说胃疼

我有一个关于在C#中的Active Directory类的问题。在我的程序一个时刻,我试图让当前域用户登录使用下面的命令:

I have a problem regarding the Active Directory classes in C#. At one moment in my program, I am trying to get the current Domain the user is logged in using the following command:

Domain.GetCurrentDomain();

很多时候,它的工作原理。但是,从无线笔记本电脑在执行的时候,它给了我下面的错误:

Most of the times, it works. But when executing from a wireless laptop, it gives me the following error:

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()

在我的具体情况,这片code应该在登录的Active Directory帐户的任何帐户,无论它正在运行的计算机或者计算机正在使用无线或有线连接连接到域。

In my particular case, this piece of code should work on any account logged in an Active Directory account, regardless of the computer it's being ran on or if the computer is connected to the domain using wireless or wired connection.

请问你们有谁知道这个问题的答案的问题或任何解决方法,我可以做,使工作?

Does anyone of you knows the answer to that problem or any workarounds I could do to make it work?

谢谢, Cydrick

Thanks, Cydrick

推荐答案

我解决了这个问题。这个问题的根源是内部对我们的业务网络。我做了几件事情:

I solved the problem. The source of the problem was internal to our business network. I did a couple of things :

设置了指向AD DNS服务器的主路由器上的第三DNS地址。 在无线网卡,把为prefered DNS服务器的AD DNS服务器的IP,并作为备用DNS服务器,主路由器的IP地址。
 
精彩推荐
图片推荐