1

I'm trying to get the groups for a user from an ADAM server using:

PrincipalContext yourDomain = new PrincipalContext(ContextType.ApplicationDirectory,
                                                   principalContextName,
                                                   principalContextContainer,
                                                   ContextOptions.ServerBind | ContextOptions.SimpleBind,
                                                   principalContextUserName,
                                                   principalContextPassword);
UserPrincipal user = UserPrincipal.FindByIdentity(yourDomain,
                                                   IdentityType.UserPrincipalName,
                                                   userName);
PrincipalSearchResult<Principal> groups = user.GetAuthorizationGroups();

And I keep getting the "server is not operational" error.

I finaly understood my problem but I dont know how to fix it.

The thing is that, the two ADAM servers are behind a firewall and an NLB, they both reply by the name of adam.company.local and the nslookup of that name, reply's 100.10.130.1

I can even ping the 100.10.130.1 and the name adam.company.local so the problem wasn't networking, but it is!

With WireShark I found out that at some point the server returns his own name and my calls start trying to call that name. Of course then the firewall blocks them and the exception occurs.

To confirm this, I made 2 lines on the hosts file, with both server names to 100.10.130.1 and the problem was gone, I could retrieve all the groups with ease.

Why is that? why does de connection change to a machine I cant get to?

The final question is how do I prevent it because on the publication machine I cant create these lines on the hosts file?

Cenas
  • 116
  • 1
  • 6

0 Answers0