Failing to iterate on object in ADAM (Suddenly)
Today I have analyzed the following exception from a developer in my group:
ExtendedErrorMessage: 000004DC: LdapErr: DSID-0C09062B, comment: In order to perform this operation a successful bind must be completed on the connection.
Message: An operations error occurred.
TargetSite: Boolean MoveNext()
at System.DirectoryServices.SearchResultCollection. ResultsEnumerator.MoveNext()
at MDALWrapper.GetNetworkAddress(Int32 instanceID)
The developer provided the following information:
- The specific scenario worked before restarting the server
- The specific scenario works great on his desktop
- In the code there is a connection to remote ADAM and using SearchResult to query for specific object and fetching specific attribute from it
- The code create a good connection to ADAM (No exception thrown)
I Googled a little for it but failed to get any real answer that could helped me <WHY AGAIN />
I have started by looking at the event viewer and found several NTP Time event regarding server cannot sync with domain
I continued and saw that the server is indeed not in sync with domain (and I hope you know already this could lead to lots of not working areas in your servers basically because of authentication issues)
I ran the "NET TIME /DOMAIN /SET" command to sync the server with the domain and retested the scenario and IT WORKED :)
Amazingly the root cause was that although the connection to ADAM was successful it was not binded using a real user (seems as if it was using anonymous connection) because the authentication failed as the server was not synced with domain time (token failed).
As always I hope this little post will save few hours to other developers / support engineers