Windows error 0x80072020, -2147016672

Detailed Error Information

DS_OPERATIONS_ERROR[1]

MessageAn operations error occurred.
Declared inwinerror.h

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode7 (0x007)
NameFACILITY_WIN32[2][1]
DescriptionThis region is reserved to map undecorated error codes into HRESULTs.[2][1]
Error Code8224 (0x2020)

This is a Win32 error which has been mapped into an HRESULT. More information may be available in error 0x00002020.

Questions

59votes
3answers

IIS application using application pool identity loses primary token?

(This is a question about a vague problem. I try to present all relevant data, in the hope that someone has helpful information; apologies for the long description.) Our web app We have a .NET 4 web application running in IIS 7.5 accessing Active Directory and a SQL Server database. [...] read more
asp.net
active-directory
iis-7.5
adsi
applicationpoolidentity
42votes
7answers

System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred

I have the same web app working in three others servers. Anyone have any idea why is not working in the 4th server? See the error and stacktrace: > An operations error occurred. > > Description: An unhandled exception occurred during the execution of the > current web request. Please [...] read more
.net
iis
active-directory
directoryservices
27votes
8answers

Active Directory COM Exception - An operations error occurred (0x80072020)

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 [...] read more
c#
.net
exception
com
active-directory
7votes
2answers

C# Active Directory PrincipalContext / UserPrincipal.IsMemberOf error

So I have a question I'm honestly not quite sure how to ask. Essentially I have a bit of code that works fantastically on my local machine when I run it. Once I publish it to our development web server, it fails. I'm not sure if it's an IIS setup [...] read more
c#
active-directory
directoryservices
6votes
1answer

DirectoryServicesCOMException (0x80072020) when using Active Directory from ASP.NET application

INTRODUCTION I'm maintaining a legacy ASP.NET 3.5 application that queries Active Directory. The application uses "Integrated Windows Authentication" and is designed to connect to Active Directory using its own security context rather than a dedicated username and password. Here is the relevant code. using (DirectoryEntry root = new DirectoryEntry()) using [...] read more
asp.net
active-directory
windows-authentication
6votes
3answers

Error: "An operations error occurred" in System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity

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<Principal> memberOfGroups = user.GetGroups(); IEnumerator<Principal> memberOfGroupsEnumerator = memberOfGroups.GetEnumerator(); List<string> userADGroups = new List<string>(); try { while (memberOfGroupsEnumerator.MoveNext()) { userADGroups.Add(memberOfGroupsEnumerator.Current.ToString()); } [...] read more
c#
asp.net-mvc-3
iis-7
4votes
1answer

Generate GPO Report From Untrusted Domain

I'm calling LogonUser with LOGON_TYPE_NEW_CREDENTIALS and LOGON32_PROVIDER_WINNT50 to get my thread to impersonate a user in the other domain. I'm able to connect to remote file shares and everything else just fine into the untrusted domain. The problem I'm running into now is when I use GPMGMTLib to generate a [...] read more
c#
.net
active-directory
4votes
1answer

ASP.NET MVC Windows Authentiaction and DirectoryServices - Get Mail Address of the current user throws an InvalidCastException

I am using ASP.NET MVC 4 and Windows Authentication. When I am using VisualStudio everything works fine, but when I deploy my site an exception is thrown. var emailAddress = UserPrincipal.Current.EmailAddress; throws: > Unable to cast object of type > 'System.DirectoryServices.AccountManagement.GroupPrincipal' to type > 'System.DirectoryServices.AccountManagement.UserPrincipal'. The rest works fine. Users [...] read more
c#
asp.net-mvc
windows-authentication
directoryservices
userprincipal
3votes
4answers

ASP.NET User Impersonation

I have an ASP.NET MVC application that accesses an database to retrieve some data and updates data on another database when the form is submitted. Both databases and IIS are on different servers and the users will be accessing this remotely, but everything is within out intranet. Access to the [...] read more
c#
asp.net
asp.net-mvc
3votes
1answer

System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred.

I'm trying to get the email address from a user that is submitting an ASP.NET form on the local intranet. When testing this on my local machine it works fine. But when I publish and begin testing it in production it doesn't like line 74. Server Error in '/' Application. [...] read more
c#
asp.net
active-directory
3votes
1answer

ApplicationPoolIdentity permissions and UserPrincipal

I've been receiving a COM Exception when performing an AD Search in an ASP.NET 4.0: An operations error occurred (0x80072020) The thread Active Directory COM Exception - An operations error occurred (0x80072020) pointed me in the right direction - The issue described is permissions-related. As a workaround, I switched the [...] read more
asp.net
iis-7
application-pool
directoryservices
3votes
2answers

Web App works on localhost but fails on remote connection

We have a new ASP.NET web application we are deploying that uses a separate DLL which we also built which in turn interrogates the Active Directory for simple user and group membership information. The server is Windows Server 2003. The application works fine if I RDP to the server and [...] read more
asp.net
active-directory
code-access-security
2votes
3answers

Exchange 2010 SP3 upgrade fails during preparation

I'm trying to upgrade our Exchange 2010 SP1 server to SP3 in preparation of installing a new Exchange 2013 server to take over, which requires SP3 on the 2010 machine to be able to migrate. While all prerequisite checks succeed (1 warning related to an update for failover clustering not [...] read more
windows-server-2008-r2
exchange-2010
upgrade
2votes
1answer

asp.net application userprincipal.findbyidentity works with browser on server, throws exception from my machine

I have an application that is running on an IIS 7 server, in this program I need to find all the groups that the current user is a member of. When I access the website using the browser on the server, it works perfectly, but when I try to access [...] read more
asp.net
iis-7
directoryservices
active-directory-group
userprincipal
2votes
2answers

ASP.NET - Accessing Active Directory from code behind page

I have made a web application, which reads/writes from/to Active Directory. In my web.config file there is <identity impersonate="true"/> and <authentication mode="Windows"/> When I display System.Web.HttpContext.Current.User.Identity.Name in some label, it shows mydomain\myusername, so I think impersonation works. Now to the question. When I access the application on the server, where [...] read more
asp.net
active-directory
2votes
0answers

userprincipal.findbyidentity an operations error occurred

Okay so, I have been given the responsibility to migrate a website with multiple applications to another server. That migration went well (all applications working). However, the performance of that new server was sub par (whole other story). We decided to migrate it again. This time everything is working very [...] read more
asp.net
vb.net
iis
2votes
1answer

asp.net Application identifies user on localhost but not on server without hard coding username / password

I'm setting up a new asp.net site on IIS8 (windows server 2012). I'm trying to take older code that works on windows server 2008, IIS6. Both are virtual servers. Windows authentication is enabled. Anonymous Authentication is disabled. (tried enabling per some post I read but no change) Getting the user [...] read more
c#
asp.net-mvc
iis-8
windows-server-2012
2votes
2answers

DirectoryServicesCOMException on IIS7 with System.DirectoryServices.AccountManagement but not in dev

The following code works fine on my dev PC but crashes when deployed to the server: using System.DirectoryServices.AccountManagement; using (var ctx = new PrincipalContext(ContextType.Domain, domainName)) using (GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, groupName)) { if (grp == null) return new string[0]; return grp.GetMembers(true).Select(m => m.SamAccountName).ToArray(); } The crash is as follows: [...] read more
c#
iis-7
active-directory
windows-server-2008
directoryservices
2votes
1answer

UserPrincipal Object, Active Directory Query: DirectoryServicesCOMException

Apologies for duplicate of System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred but I can't comment yet and there's no answer. The solution from this question, did not work. Error on publishing: System.DirectoryServices.DirectoryServicesCOMException I've got a new ASP.NET MVC 3 web application project with Razor view engine in Visual Studio 2010. It is [...] read more
c#
asp.net
1vote
1answer

Migrating app in IIS 6 to 7.0

I have web app written in .NET 2.0 hosted under IIS 6.0 with integrated authorization enabled. I moved this app to Windows Server 2008 R2 with IIS 7.5 with Windows auth enabled, and now I am getting this error. Any help? > Security Exception > > Description: The application attempted [...] read more
iis
iis-7
1vote
1answer

Error when using UserPrinciple on a remote machine

So I have a hosting domain that's currently running my App on IIS 7, Application Pool Settings: * Identity: Network Service * Managed Pipeline Mode: Integrated * .NET Version: v4.0 * Name: .NET v4.5 IIS Authentication settings: * Anonymous: Disabled * Impersonation: Enabled * Forms: Disabled * Windows: Enabled There [...] read more
c#
networking
asp.net-mvc-5
iis-7
userprincipal
1vote
1answer

DirectoryServiceCOMException (0x80072020) when calling UserPrincipal.FindByIdentity

Trying to troubleshoot a bug with user creation based on AD credentials and I'm getting the above exception, but because of access restrictions my available information is somewhat limited to logfiles. I know this is a permissions issue, but all the suggestions I've found have produced no different results. This [...] read more
c#
exception
authentication
active-directory
asp.net-mvc-5
1vote
1answer

PrincipalContext: Exception Details: System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred

I am trying to search AD for a user, but it keeps throwing an exception. The application is setup to use AppPool. and I am certain that the logged in user has access to search AD. Code: public static UserADInfoModel ResolveUserProperties(string sam) { UserADInfoModel uad = new UserADInfoModel(); PrincipalContext DC [...] read more
c#
active-directory
directoryservices
principalcontext
principalsearcher
1vote
0answers

Adding computer to an AD group via asp.net (c#) in a cross forest

Following problem: i'm trying to add a computer to an Active Directory group via ASP.NET & C# for a little rollout tool. But as soon as i upload it on my server (IIS 8.5) the trouble starts. Everything like search for computers and groups works perfectly fine, but adding new [...] read more
c#
asp.net
.net
iis
1vote
1answer

Powershell Invoke-Command Operations Error

I'm stumped by this issue. I've written a powershell script which I'm trying to use to import a GPO across multiple domains and then link it with new-gplink. I've made sure all servers have GP Powershell module installed and it's been working pretty well so far, however the issue I'm [...] read more
powershell
1vote
1answer

Active Directory access using HostingEnvironment.Impersonate() fails to find the user

I have looked at every posting regarding the reasons for the following exception: > An unhandled exception has 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() It appears that the best solution for this issue is to use HostingEnvironment.Impersonate() when [...] read more
c#
asp.net-mvc-3
iis
active-directory
1vote
2answers

active directory users on asp.net

I want to create a directory intranet web site using Active Directory for our company. I got this so far, but when I run in debug mode the code breaks in searchResultCollection....search.findAll(); displaying: > [DirectoryServicesCOMException (0x80072020): An operations error occurred.] I have tried changing the IIS asp.net impersonation to enabled [...] read more
c#
asp.net
iis-7
active-directory
ldap
1vote
1answer

UserPrincipal.FindByIdentity sometimes failing with DirectoryServicesCOMException: An operations error occurred

We are a team where everyone of us experience this somewhat random error. The error is listed below and appears on the line: UserPrincipal.FindByIdentity(principalContext, windowsPrincipal.Identity.Name); It works just fine several days/weeks/months, and then one of us get this error. On our test server, where we do not deploy changes to [...] read more
asp.net
visual-studio
active-directory
claims-based-identity
1vote
0answers

Delegation not working on some computers

I have an asp.net application that uses delegation to perform actions on the Active Directory as the authenticating user. The application works perfectly on some computers and doesn't work at all on other computers, on these other computers they receive a COMexception error code 0x80072020 the stack trace is: System.Runtime.InteropServices.COMException [...] read more
c#
asp.net
iis-7
delegation
1vote
1answer

Executing Powershell script as different User in Exchange 2007 Powershell

My scenario looks like this: Java opens a Powershell in which Exchange Powershell Command/Scripts should be executed as a different user and the output should be displayed in the Powershell windows that Java opened (so Java can read the output). So: Normal Powershell --> Add Exchange functionality --> Execute Script/Command [...] read more
powershell
exchange-server
exchange-server-2007
1vote
0answers

Can't access directory services from server - DirectoryServicesCOMException

I'm trying to query AD in an ASP.Net (4.0) application that is running on Windows Server 2008 R2 (IIS7 installed). In runs fine on my local computer (Windows 7), but not on the server. I'm trying to get the userid of the current user. I've looked at Q&A of similar [...] read more
c#
asp.net
directoryservices
1vote
1answer

How to configure ASP.Net website to have access to Active Directory

I am trying to create a intranet website which can look up a users email address based on their Active Directory username. I have the following in my web.config: <authentication mode="Windows"/> <identity impersonate="true"/> And I can obtain the the users UserName with: Environment.UserName Running on localhost, the following code allows [...] read more
c#
asp.net
iis
active-directory
iis-7.5
1vote
1answer

Bind to Moniker not working on Windows XP 32bit using LDAP

I have the following code: <appSettings> <add key="rootDN" value="LDAP://[The rest of the path]"/> </appSettings> string rootDN = System.Configuration.ConfigurationManager.AppSettings["rootDN"]; object ou = Marshal.BindToMoniker(rootDN); This is producing an error: > Unhandled Exception: System.Runtime.InteropServices.COMException (0x80072020): > A n operations error occurred. (Exception from HRESULT: 0x80072020) at > System.Runtime.InteropServices.Marshal.MkParseDisplayName(IBindCtx pbc, St > ring szUserName, [...] read more
com
1vote
0answers

"An operations error occurred" from DirectoryServices

I'm trying to use System.DirectoryServices to query an Active Directory server, using LDAP. My code can (apparently) connect and authenticate, but when my first DirectorySearcher FindAll() method is called, I only get: [DirectoryServicesCOMException (0x80072020): An operations error occurred.] Picking apart the exception in the debugger has been remarkably unproductive. It [...] read more
c#
.net
active-directory
ldap
directoryservices
1vote
1answer

Active Directory authentication issue after reconnect - C#

adding more info on @serialhobbyist's request hi all. we're (= me and my colleagues) using PrincipalContext from System.DirectoryServices.AccountManagement to retrieve some authentication info (make sure a user belongs to a group etc). Important: our client is a service running as LocalSystem. this does not happen when we run in a [...] read more
c#
active-directory
ldap
0votes
0answers

New-Object -Type Microsoft.GroupPolicy.GPDomain fails when run remotely

I am trying to run a script remotely (via vRO - essentially WinRM invoke), and am running into an issue with getting some commands to run. I have two DCs: PRIDC and SECDC. The command I'm having issues with: $gpDomain = New-Object -Type Microsoft.GroupPolicy.GPDomain It works when run manually on [...] read more
powershell
active-directory
0votes
0answers

SSIS Active Directory extract getting periodic errors

I am running an Active Directory extract via SSIS Script Component and receiving the same error randomly: > Error Code: -1073450910 Error Description: > System.DirectoryServices.DirectoryServicesCOMException (0x80072020): An > operations error occurred. > > at > Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception > e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 > outputs, Int32[] outputIDs, PipelineBuffer[] buffers) at > Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100 > [...] read more
c#
ssis
active-directory
0votes
1answer

Form Authentication - An operation error occured FindByIdentity

i have a form authentication: <authentication mode="Forms"> </authentication> <authorization> <deny users="?" /> </authorization> I have a page with my login and to check the credential I do: public static bool ValidateCredentials(string sUserName, string sPassword, string sDomain) { PrincipalContext oPrincipalContext = GetPrincipalContext(sDomain); try { return oPrincipalContext.ValidateCredentials(sUserName, sPassword); } catch (Exception ex) [...] read more
c#
directoryservices
form-authentication
userprincipal
0votes
1answer

jQuery $.ajax post works perfectly fine on local, but throws 500 error on server

I am working on app which should manage custom team structure so when team leaders adds their members I want them to add only login add pull the First name and Last name from AD. It works fine when I run it on local, but I get 500 Internal server [...] read more
jquery
asp.net-mvc
0votes
1answer

LDAP connection only works on localhost

I have a login page that verifies credentials with active directory and redirects to the next page. When I run it locally it works perfect, but when I put it out on our webserver it gives an error trying to create the group principal: (System.DirectoryServices.DirectoryServicesCOMException (0x80072020)) I need to find [...] read more
c#
asp.net
web-applications
active-directory
ldap
0votes
1answer

Accessing Active Directory using current user context with impersonation switched on

I am trying to create a self service page for our internal users to manage their own file access by adding/removing users from AD security groups. I would like the site to run under the context of the user accessing the page as we already have all of the security [...] read more
c#
asp.net
active-directory
0votes
1answer

Com Interop error when using impersonation on ASP.NET

I am trying to write a ASP.NET page that looks at group membership for authorization of a site. I have code that is working when run in the local debugger and when locally logged into the web server itself. However, when i try to access the page from a remote [...] read more
c#
asp.net
com-interop
impersonation
0votes
1answer

Throw DirectoryServicesCOMException (0x80072020) when try to RefreshCache for DirectoryEntry

I write a very sample test program and run it as local system account in a domain machine. Here is the code look like: static void Main(string[] args) { try { System.Console.Out.WriteLine("Test Start"); List<string> temp = new List<string>(); temp.Add(Environment.UserDomainName); temp.Add("test"); temp.Add("test.com"); temp.Add("dc.test.com"); temp.Add("gc.test.com"); foreach (var i in temp) { using [...] read more
active-directory
ldap
directoryentry
0votes
2answers

LDAP: Unable to Change Password

I am doing the c# code to change a ldap user's password by either user himself, or the admin. I can successfully authenticate the users. However, I get the following error message when I try to invoke a ChangePassword or SetPassword behavior: > InnerException: The directory property cannot be found [...] read more
c#
active-directory
ldap
directoryentry
0votes
1answer

ActiveDirectory query doesn’t work from server

I’m trying to get user details based on group membership from ActiveDirectory. This works on my local machine, but not when I run it on the server. What I don’t understand is that it will return the number of members of the group correctly (although it has to be in [...] read more
c#
active-directory
0votes
2answers

System.DirectoryServices.DirectoryServicesCOMException

I keep getting the following error when trying to run an application in the production environment with "anonymous" authentication and hardcoded username. When I turn on basic authentication, which then prompts for username/password everything works like a charm. but I need to get the hardcoded version to work as well. [...] read more
asp.net
0votes
1answer

Inherited ASP.NET code that connects to OD not working when connected to AD

I've inherited a piece of software that connects to our Open Directory to provide web authentication. When connected to the OD it works like a charm but we want to transition to using Active Directory as our main authentication provider. Obviously there are differences in the LDAP scheme between the [...] read more
asp.net
active-directory
ldap
0votes
1answer

Set password for active directory lightweight directory services (ad lds) on .net 2.0

I am trying to create a new user and set their password in AD LDS using asp.net vb. I'm binding to an instance of a directory entry, which is working fine. And I can add a user without a problem. The problem is that I can't seem to set the [...] read more
asp.net
vb.net
active-directory
0votes
1answer

Impersonation using a self-hosted WCF WebServiceHost gets 'An operations error occurred.' error

So I have been banging my head on this one. I have a self hosted WCF service: var webServiceHost = new WebServiceHost(helloWorld); webServiceHost.Authorization.ImpersonateCallerForAllOperations = true; var uri = new Uri(BaseUri + webService.UriDirectory); var webHttpBinding = new WebHttpBinding(webHttpSecurityMode); webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; var sep = webServiceHost.AddServiceEndpoint(IHelloWorld, webHttpBinding, uri); var webHttpBehavior = new [...] read more
c#
wcf
security
impersonation
self-hosting
0votes
1answer

Error with Directory.Services when on production

The following code works fine in Visual Studio Development enviroment on my local machine. However when I move the files to a Windows 2008 R2 IIS 7.5 machine I get the following error: > [DirectoryServicesCOMException (0x80072020): An operations error occurred. ] > _Default.GetFullName(String strLoginName, String& STR_FIRST_NAME, String& > STR_LAST_NAME, String& [...] read more
c#
asp.net
active-directory
directoryservices
0votes
1answer

Unable to add user with CrmService API in Dynamics CRM

We have Dynamics CRM 4 update rollup 6 configured as an IFD and have set the UserRootPath using the deployment configuration tool. Adding users through the CRM interface works perfectly. However, when trying to add a user through the CrmService API, the user is not added and we get the [...] read more
dynamics-crm
dynamics-crm-4
0votes
4answers

Updating Active Directory from Web Application Error

I am receiving an error a web based application that allows corporate intranet users to update their active directory details (phone numbers, etc). The web application is hosted on IIS6 running Windows Server 2003 (SP1). The IIS website is using NTLM Authentication and the website has integrated security enabled. The [...] read more
c#
asp.net
security
active-directory
-1votes
1answer

userprinciple.FindByIdentity succeeds on one server but not another

I have been tasked with migrating some c# v4 apps from one server to another, and I have hit an issue with one of the aspx forms. The form has the a call to a class to search for an AD user in its code behind file. The method it [...] read more
c#
asp.net
active-directory
-2votes
1answer

Premissions to access LDAP from a windows service

I'm building a windows service that polls a windows file share location for a file containing members that may be found in LDAP. The windows service is running as a specific user on the domain to have access to the file share. This user is in the Administrator group both [...] read more
c#
permissions
ldap

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0