Active Directory An Operations Error Occurred
Contents |
here for a quick overview of
Directorysearcher Findone An Operations Error Occurred
the site Help Center Detailed answers to any questions principalsearcher an operations error occurred you might have Meta Discuss the workings and policies of this site About
Directoryoperationexception An Operation Error Occurred
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions an operations error occurred activedirectorymembershipprovider Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error: “An operations error occurred” in directoryservicescomexception an operations error occurred System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity up vote 4 down vote favorite 1 I have the following code to retrieve AD groups of a given user name in my MVC3 web application: PrincipalContext userDomain = new PrincipalContext(ContextType.Domain, username.Split('\\')[0]); UserPrincipal user = UserPrincipal.FindByIdentity(userDomain, username); PrincipalSearchResult
here
System.directoryservices.directoryservicescomexception An Operations Error Occurred
for a quick overview of the site directorysearcher findall an operations error occurred Help Center Detailed answers to any questions you might have Meta Discuss
An Operations Error Occurred Ldap
the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/21529386/error-an-operations-error-occurred-in-system-directoryservices-accountmanagem about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each http://stackoverflow.com/questions/7285503/active-directory-com-exception-an-operations-error-occured-0x80072020 other. Join them; it only takes a minute: Sign up Active Directory COM Exception - An operations error occured (0x80072020) up vote 20 down vote favorite 7 I am getting an intermittent COM Exception "An operations error occurred (0x80072020)" (shown below) when I try and query Active Directory using the method GroupPrincipal.FindByIdentity Here is my code: PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Environment.UserDomainName); GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "Group to find"); I am receiving Exception: Inner Exception: System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.PropertyValueCollection.PopulateList() at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) at System.DirectoryServices.PropertyCollection.get_Item(String propertyName) at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identi
Web Platform Installer Get Help: Ask a Question in our Forums More Help Resources Blogs Forums Home IIS.NET Forums IIS 7 and Above Security An operations error occurred https://forums.iis.net/t/next/1210860 An operations error occurred [Answered]RSS 3 replies Last post May 07, 2014 08:44 AM by Ken Schaefer ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads http://www.pcreview.co.uk/threads/an-operations-error-occurred.3457737/ Unanswered Threads Unresolved Threads Advanced Search Reply joegreen2005 11 Posts An operations error occurred May 06, 2014 01:38 PM|joegreen2005|LINK Hi there, I’m using ASP.NET 2.0 and C#. I’ve a web error occurred form with username and password. Username is loaded automatically by grabbing the user id of the person who is currently logged on to the machine. All user has to do is type their AD password and click on Login button. After the user succfully logs in, I write a session cookie having two values – username and full name (Given Name an operations error and Last Name). This works on the development machine running IIS 7.5. I can login and write a cookie with both the values. But it doesn’t work on production server running IIS 6.0. I get error - An operations error occurred. Here is my code: string AdPath = "LDAP://mydomain:389/OU=Users,DC=com "; ActiveDirectoryValidator adAuth = new ActiveDirectoryValidator(AdPath); if (true == adAuth.IsAuthenticated(domainName, userName, password)) { HttpCookie cookie = Request.Cookies["whoyou"]; if (cookie == null) { cookie = new HttpCookie("whoyou"); cookie["Name"] = userName; DirectorySearcher dssearch = new DirectorySearcher(AdPath); dssearch.Filter = "(sAMAccountName=" + userName + ")"; SearchResult sresult = dssearch.FindOne(); DirectoryEntry dsresult = sresult.GetDirectoryEntry(); cookie["Full Name"] = dsresult.Properties["givenName"][0].ToString() + " " + dsresult.Properties["sn"][0].ToString(); Response.Cookies.Add(cookie); Response.Redirect("display.aspx"); } } I noticed that I get this error at the following line on IIS 6 SearchResult sresult = dssearch.FindOne(); If I comment out the above line, then I can login and write a session cookie with just the user id. It seems that for some reason on IIS 6 I cannot search directory. Here is my web.config code: querying active directory. It happens so far only on one computer under a particular user account. Things seem to work fine for that user on another computer, and if I logon to her computer the query works fine as well. here is the C# code I'm using to do the query: private static DirectoryEntry GetUserEntry( WindowsIdentity ident ) { string directoryServer; DirectorySearcher searcher; DirectoryEntry domainEntry, result; SearchResult results; string userName; result = null; using ( domainEntry = new DirectoryEntry( "LDAP://rootdse" ) ) { directoryServer = domainEntry.Invoke( "GET", "defaultNamingContext" ).ToString(); } if ( string.IsNullOrEmpty( directoryServer ) ) { throw new InvalidOperationException( Properties.Resources.CannotDetermineDirectoryServer ); } if ( directoryServer.StartsWith( @"\\" ) ) { directoryServer = directoryServer.Substring( 2 ); } using ( domainEntry = new DirectoryEntry( string.Format( "LDAP://{0}", directoryServer ) ) ) { userName = ident.Name; if ( userName.IndexOf( @"\" ) > -1 ) { userName = userName.Substring( userName.IndexOf( @"\" ) + 1 ); } using ( searcher = new DirectorySearcher( domainEntry, string.Format( "SAMAccountName={0}", userName ) ) ) { results = searcher.FindOne(); result = results.GetDirectoryEntry(); } } return result; } The initial part seems to succeed (querying for the rootdse), but finding the SAMAccount is failing for some reason. Any ideas? Here's the exception: System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindOne() at MyCompan.Application.UserInfo.GetUserEntry(WindowsIdentity ident) Andy, Mar 21, 2008 #1 Advertisements Joe Kaplan Guest This happens when you bind to AD as the anonymous user. That usually happens as a result of supplying default credentials in your DirectoryEntry (null, null) and being logged in a non-domain user. Are you sure the user having this problem is logged in with a domain account? There are also a few things you can do if you want to tighten up this code a bit, but I'll hold off on commenting there unless