<div>I have an been running into intermittent issues using the directorySearcher class when searching Active Directory using LDAP. The error message reads:
System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational</div> <div> </div> <div>The
application is farmed out on 4 servers, AD environment is also farmed out on 4 servers as well. The code used to run the search has run fine over the past couple of months, however all of the sudden 3 of the 4 application server's log files started filling
up with this error message (on every search). I ended up re-booting the severs and now everything seem to be running again.
</div> <div> </div> <div>After looking around on the forums, I have made a few changes to the code and
I wanted to have someone look at them and either validate the changes, or recommend another ailment.
</div> <div> </div> <div>Code:</div> <div> </div>
<div>Public Sub New(ByVal strUserLanId As String)</div> <div> </div> <div>
If strUserLanId Is Nothing Then
Throw New ArgumentNullException("strUserLanId", "String strUserLanId cannot be null")
End If</div> <div> </div> <div> Dim de As New DirectoryEntry
de.Path = ConfigurationSettings.AppSettings("ActiveDirectoryConnectionString")
'Path = "LDAP://[servername-cluster]/dc=mfad,dc=mfroot,dc=org"</div> <div> </div> <div>
de.Username = ********
de.Password = ********</div> <div> </div> <div> Dim srch As DirectorySearcher
Dim srchResults As SearchResultCollection
Dim srchResult As SearchResult
Try
srch = New DirectorySearcher(de) 'Old Filter --
'srch.Filter = "(SAMAccountName=" & strUserLanId.Substring(strUserLanId.IndexOf("\"c) + 1).ToUpper & ")" 'New Filter --
srch.Filter = "(&(objectCategory=user)(objectClass=user)(SAMAccountName=" & strUserLanId.Substring(strUserLanId.IndexOf("\"c) + 1).ToUpper & "))"
srch.PropertiesToLoad.Add("memberOf")
'--
srchResults = srch.FindAll() 'FindOne() method has a memory leak in .NET 1.1, so using FindAll()
If (Not srchResults Is Nothing) AndAlso Not (srchResults.Count <= 0) Then
srchResult = srchResults(0)
End If</div> <div> </div> <div> If Not srchResult Is Nothing Then
Dim adUser As DirectoryEntry = srchResult.GetDirectoryEntry
_roleNames = FormatRoleNames(GetPropertyArray(adUser, "memberOf")) 'Old Clean up
'adUser.Dispose()
'adUser.Close() 'New Clean up
adUser.Close()
adUser.Dispose()
Else
Throw New OneViewShared.ActiveDirectoryUserNotFoundException("User " & strUserLanId & " not found.")
End If</div> <div> </div> <div> Catch ex As System.Runtime.InteropServices.COMException
Throw New OneViewShared.ActiveDirectoryException("Unable to retrieve Active Directory listing", ex)
Finally
srch.Dispose()
End Try</div> <div> </div> <div> End Sub</div> <div> </div>
<div> </div> <div>Thanks,</div> <div>Ryan</div>
i ma getting error when i am using FindOne() or FindAll() method with SearchResult and SearchResultCollection respectively.
also for directoryentry.children.find()
the error i am getting is :
System.Runtime.InteropServices.COMException: The server is not operational
rk657x
Member
5 Points
1 Post
System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational
Dec 05, 2006 05:22 PM|LINK
Throw New ArgumentNullException("strUserLanId", "String strUserLanId cannot be null")
End If</div> <div> </div> <div> Dim de As New DirectoryEntry
de.Path = ConfigurationSettings.AppSettings("ActiveDirectoryConnectionString")
'Path = "LDAP://[servername-cluster]/dc=mfad,dc=mfroot,dc=org"</div> <div> </div> <div> de.Username = ********
de.Password = ********</div> <div> </div> <div> Dim srch As DirectorySearcher
Dim srchResults As SearchResultCollection
Dim srchResult As SearchResult
Try
srch = New DirectorySearcher(de)
'Old Filter --
'srch.Filter = "(SAMAccountName=" & strUserLanId.Substring(strUserLanId.IndexOf("\"c) + 1).ToUpper & ")"
'New Filter --
srch.Filter = "(&(objectCategory=user)(objectClass=user)(SAMAccountName=" & strUserLanId.Substring(strUserLanId.IndexOf("\"c) + 1).ToUpper & "))"
srch.PropertiesToLoad.Add("memberOf")
'--
srchResults = srch.FindAll() 'FindOne() method has a memory leak in .NET 1.1, so using FindAll()
If (Not srchResults Is Nothing) AndAlso Not (srchResults.Count <= 0) Then
srchResult = srchResults(0)
End If</div> <div> </div> <div> If Not srchResult Is Nothing Then
Dim adUser As DirectoryEntry = srchResult.GetDirectoryEntry
_roleNames = FormatRoleNames(GetPropertyArray(adUser, "memberOf"))
'Old Clean up
'adUser.Dispose()
'adUser.Close()
'New Clean up
adUser.Close()
adUser.Dispose()
Else
Throw New OneViewShared.ActiveDirectoryUserNotFoundException("User " & strUserLanId & " not found.")
End If</div> <div> </div> <div> Catch ex As System.Runtime.InteropServices.COMException
Throw New OneViewShared.ActiveDirectoryException("Unable to retrieve Active Directory listing", ex)
Finally
srch.Dispose()
End Try</div> <div> </div> <div> End Sub</div> <div> </div> <div> </div> <div>Thanks,</div> <div>Ryan</div>
Directory Services DirectoryEntry Active Directory
sacdhoom
Member
32 Points
8 Posts
Re: System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational
Mar 22, 2007 10:57 AM|LINK
Hi
I am doing the active directory list program.
i ma getting error when i am using FindOne() or FindAll() method with SearchResult and SearchResultCollection respectively.
also for directoryentry.children.find()
the error i am getting is :
System.Runtime.InteropServices.COMException: The server is not operational
Directory Services DirectoryEntry Active Directory ActiveDirectoryMembershipProvider