locked
PrincipalContext error RRS feed

  • Question

  • User-1123536643 posted

     

    using (var context = new PrincipalContext(ContextType.Machine, "ip_address_of_domain_controller", null, ContextOptions.Negotiate, "domain_name\\administrator", "password"))
         

    Results in:

    System.DirectoryServices.AccountManagement.PrincipalOperationException:

    'Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

    Connecting with ContextType.Domain work fine, but I need to connect to the domain controller to get the last successful logons. When I use a domain user (even if they are in the domain admins group) I get an Access is denied error with the above code.

    Cheers

    Danny

    Wednesday, June 14, 2017 10:41 AM

All replies

  • User1967761114 posted

    Hi danny_uk,

    According to your description, this exception means the user which you using to login the domain controller had been established more connection with the server, and the connection amount is out of the limit connection amount in windows.

    To resolve this problem, you could restart the "Workstation" service on the domain server.

    Note: The "Workstation" service manages shared resource connections. Restarting the service will force a release of the network connection.  Because of this, however, there are multiple dependent services, so I suggest you’d better wait for auto release the network connection by the service. 

    Or you could try to use servername to instead IP, see the following code:

    using (var context = new PrincipalContext(ContextType.Machine, "server_name_of_domain_controller", null, ContextOptions.Negotiate, "domain_name\\administrator", "password"))

     

    If you have any other questions, please feel free to contact me any time.

    Best Regards

    Even

    Thursday, June 15, 2017 9:05 AM
  • User-1123536643 posted

    Hi Even

    Thanks for the help. Before trying the Workstation solution, do you know why a user who is in the domain admins group is getting Access is denied, where as the domain administrator does not. Is there a group the user needs to be in?

    Cheers

    Danny   

    Thursday, June 15, 2017 10:51 AM
  • User1967761114 posted

    Hi dannyg_uk,

    do you know why a user who is in the domain admins group is getting Access is denied, where as the domain administrator does not. 

    As far as I know, domain admins groups are the member of administrators groups, about this question, you could refer to the following link.

    https://social.technet.microsoft.com/Forums/en-US/98b23d0c-e9d0-447e-9a91-317451266d75/difference-between-domain-admins-builtin-administrators-group-?forum=winserverDS

    Is there a group the user needs to be in?

    If the account is in domain admins groups, the account has enough permission to access the domain, for more details about this issue, you could refer to the following link.

    https://technet.microsoft.com/en-us/library/dn579255(v=ws.11).aspx#About Active Directory groups

     

    If you have any other questions, please feel free to contact me any time.

    Best Regards

    Even

    Monday, June 19, 2017 7:18 AM