I have some code vb.net winforms, that works fine most of the time but stops working occasionally such as right now.
The code is this
Dim objDE As New DirectoryEntry("LDAP://" & DomainName)
Dim objDS As DirectorySearcher = New DirectorySearcher(objDE)
Dim results As SearchResultCollection
Try
objDS.Filter = "(objectClass=user)"
'Find all users
results = objDS.FindAll()
When the FindAll fails I get the error message
Error in Debug Mode
The server is not operational
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObjects()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll()
at /line in my code/
The value of 'domain name' is correct and is the W2k Domain server.
This works fine then stops working for a few hours then starts working again with no server downtime or changes.
Any ideas why the server is not operational message would appear? I'm guessing its a network related issue
TIA
I've never had this problem! Are you at a remote site? Do you have a fast
connection? Do you have a large domain(s)?
Do you bind to a specific Domain Controller
(LDAP://MyDomainController/DC=Contoso,DC=com or just to the
defaultNamingContext (LDAP://DC=Contoso,DC=com)
FYI: (ObjectClass=User) will search for groups as well.
(&(objecClass=user)(objectClass=person)) is what I use most of the time. and
I only load the attributes that I will be using.
objDS.PropertiesToLoad.AddRange(New String() {"sAMAccountName", "cn", "sn"})
that seems to speed things up a bit as well.
>I have some code vb.net winforms, that works fine most of the time but
>stops working occasionally such as right now.
[quoted text clipped - 33 lines]
>
> <Id>nbnfIFee30OSktz/HCE9TA==</Id