Home > An Error > An Error 1301 Occurred While Enumerating The Groups

An Error 1301 Occurred While Enumerating The Groups


Posted by Ron Verheij on 10/2/2013 at 1:56 AM I had the same issue (.NET4.5) and it cost us a little project delay. After upgrading to Server 2012 Domain Controller 8 answers Background: I've been using UserPrincipal.GetAuthorizationGroups for a while now to check permissions in 2 different applications. Microsoft have released a hotfix for this issue which can be downloaded below. Posted by mohlsen on 4/15/2010 at 8:09 AM This is apparently do to the fact that there are SIDs in the GroupPrincipal objects returned that cannot be resolved in AD. have a peek here

Contact Office hours, holidays, phone numbers, email, address, bank details and press contact information. Original Code public bool isGroupMember(string userName, ArrayList groupList) { bool valid = false; PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain_server + ".domain.org:636", null, ContextOptions.Negotiate | ContextOptions.SecureSocketLayer); // find the user in the Sign in Gallery MSDN Library Forums Get started for free Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Can't share|improve this answer answered Jan 20 '14 at 13:16 community wiki John Reilly add a comment| up vote 2 down vote I experienced error code 1301 with UserPrincipal.GetAuthorizationGroups while using a http://stackoverflow.com/questions/17027781/userprincipals-getauthorizationgroups-an-error-1301-occurred-while-enumerating

An Error Occurred While Enumerating Through A Collection

Company Go to Company overview » About us Meet the CodeTwo team and read about the company‚Äôs history. I don't believe that our AD list will take a large amount of time to validate for orphaned SID's. Because the problem happens when iterating over the collection, I use a different approach when iterating in order to handle the exception without blocking the actual iterating: private string[] GetUserRoles(string Username) The group's SID could not be resolved.

The issue is still occurring, and I'm still optimizing code hoping for the best. Are we seeing everything slowly? In my research I found a thread that looks unrelated, but actually has the same stack trace. Kb2830145 We are hoping to see if it is just a specific server communication issue or to see if it is the entire set of Domain Controllers.

ie, "user.IsMemberOf(group)". more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed The thread suggests that finding the tombstoned enteries and removing them from the groups solves the problem. http://www.codetwo.com/kb/error-1301/ using (var context = new PrincipalContext(ContextType.Domain, _domainName)) { try { var p = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username); if (p == null) throw new NullReferenceException(string.Format("UserPrincipal.FindByIdentity returned null for user: {0}, this can indicate

Few things you have to do before this code can work 1) You have to reference the assembly System.DirectoryServices 2) Make sure to pass "theusername" variable without the domain, so if Getauthorizationgroups The Group Could Not Be Found I could easily reproduce the issue using PowerShell: Function Get-UserPrincipal($cName, $cContainer, $userName){ $dsam = "System.DirectoryServices.AccountManagement" $rtn = [reflection.assembly]::LoadWithPartialName($dsam) $cType = "domain" #context type $iType = "SamAccountName" The key information about what was happening was found here: MS blog translated from German The hotfix referred to in the link below has fixed the problem on our test system Exception: Exception information: Exception type: PrincipalOperationException Exception message: An error (1301) occurred while enumerating the groups.

An Error Occurred While Enumerating Through A Collection More Data Is Available

Not the answer you're looking for? my site The time frame has been too short to determine if the adjusted code has fixed the issue, but I will continue to update as we work towards a resolution such that An Error Occurred While Enumerating Through A Collection Why us? An Error Occurred While Enumerating Through A Collection Access Is Denied Posted by Microsoft on 12/30/2009 at 6:09 PM Thanks for your feedback.

Is there a proof that is true for all cases except for exactly one case? http://svbuckeye.com/an-error/an-error-1332-occurred-while-enumerating-the-group-membership.php The group's SID could not be resolved. or download fix from here like said @Tilo: http://support.microsoft.com/kb/2830145 public bool IsMember(UserPrincipal user, string groupName) { try { var context = new PrincipalContext(ContextType.Domain, Environment.UserDomainName); var group = GroupPrincipal.FindByIdentity(context, groupName); if (group After upgrading to Server 2012 Domain Controller Related 10While trying to retrieve the authorization groups, an error (5) occurred2How to find users in AD that belong to a group, and just An Error Occurred While Enumerating Through A Collection Collection Was Modified

These are most likely bogus SIDs that may be removed.http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/9dd81553-3539-4281-addd-3eb75e6e4d5dI will post my workaround in the Workaround section. Cycles ignores smooth more hot questions question feed lang-cs about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts The group's SID could not be resolved. http://svbuckeye.com/an-error/an-error-occurred-when-populating-microsoft-crm-user-groups.php When a 2012 domain controller is involved, the GetAuthorizationGroups() function would fail on groups (SIDs) that are added to a user by default.

I'm currently enclosing the iEnumerable items in [using] statements while trying to track down issues via perfmon. An Error 1332 Occurred While Enumerating The Group Membership The Member's Sid Could Not Be Resolved After upgrading to Server 2012 Domain Controller up vote 20 down vote favorite 5 Research: Similar Issue with workaround, but not actual solution to existing problem Similar issue pointing to Microsoft On May 15 2013 we removed a primary Domain controller running Server 2008 (not r2) and replaced it with a Server 2012 Domain Controller.

I use Principal Context for Forms Authentication.

The production server is still functioning terribly. This will resolve the following issue: An error (1301) occurred while enumerating the groups. It seems to work consistently well. Getauthorizationgroups Error What are the Starfleet regulations on crew relationships or fraternizing?

I also instituted a cron that runs on two separate servers. Will monitor for issues. // test membership in SuperUsers const string superUsersGroupName = "MyApp-SuperUsers"; using (var superUsers = GroupPrincipal.FindByIdentity(principalContext, superUsersGroupName)) { if (superUsers != null && user.IsMemberOf(superUsers)) // add to the The username/pass handshake succeeds and the auth cookie is properly set, but the subsequent Principal Context call that also calls UserPrincipal.GetAuthorizationGroups fails intermittently. http://svbuckeye.com/an-error/an-error-occurred-while-communicating-with-the-server-google-groups.php Convince family member not to share their password with me Are there studies showing that learning an L2 makes it easier to learn an L3?