Unable to load DLL after Impersonating (0x80070542)

I have an application that prompts a user for credentials and impersonates the user before taking some action on that user's behalf.  However, when I try to call some framework methods that require .NET to load a native DLL, the call fails with the
following error:
System.DllNotFoundException: Unable to load DLL 'secur32.dll': Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
I've simplified the duplication scenario down to the following:
this.userToken = IntPtr.Zero;
bool authenticated =
Win32.LogonUser(
username,
domain,
password,
LogonTypes.Network,
LogonProviders.Default,
out userToken);
if (authenticated)
this.impersonationContext =
WindowsIdentity.Impersonate(this.userToken);
// This call blows up:
string userDomain = Environment.UserDomainName;
If I make a call to Environment.UserDomainName before impersonating, no exception is thrown (presumably the DLL is loaded before impersonation, so no attempt is made afterwards).

Hi Travis,
I'm writing to check the issue status, please feel free to let us know if you have any concern.
Sincerely,
Eric
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact
[email protected]
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

Similar Messages

  • Error Message : Unable to load DLL (AddOnInstallAPI.dll)

    Hi there..
    I am lost in SBO Installation I have made an installation package for my add-on. When I want to deploy for my client, i get a very silly Microsoft .Net Framework error message, that is :
    Unable to load DLL (AddOnInstallAPI.dll)
    Here is my function to call the .dll file:
    Private Sub Install()
      Environment.CurrentDirectory = strDll
      Dim sInstaller As String = installerPath
      'installerPath is path for my Setup.exe file
      Try
         'Run a new process
         System.Diagnostics.Process.Start(sInstaller)
      Catch ex As Exception
         MsgBox(ex.Message)
         Windows.Forms.Application.Exit()
      'Loop until windows found the executables   
      While System.IO.File.Exists("C:\Program  Files\MyCompany\Statement of Account\SOA.exe") = False
      End While
      'After found the executables, then call SetAddOnFolder
      SetAddOnFolder("C:\Program Files\MyCompany\Statement of Account")
       EndInstall() ' Inform SBO the installation ended
       Windows.Forms.Application.Exit() ' Exit the installer
    End Sub
    Does anybody ever face the same problem? My Client are using SBO2004 P9. I created all my addon using SDK P23. Is there any effect using different patches?
    Just for your information, I try to uninstall everything, and re-install SBO2004A Patch 9 in my computer (same as my client) and it works fine!! Are there any other possibilities???
    Hopefully, somebody can help me...
    Thanks alot...

    yes, i put the correct strDLL string as the parameter. I am able to run the AddOnInstaller with my PC (SBO 2004A Patch 26) and I also did the installer using my PC.
    My Problem is that i can not to install in my customer PC which is using SBO2004A Patch 9.
    Does anybody has some ideas about this issue?
    Thanks for helping...

  • System.DllNotFoundException: Unable to load DLL 'OraOps10.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    Hi,
    I have a asp.net web application running on windows server 2008 with oracle server 10g installed.
    now we are planning to run application on another server with same server as database server. but when the deployed on new server the login page comes up and after login System.DllNotFoundException: Unable to load DLL 'OraOps10.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) exception is thrown. any help would highly be appreciated.

    Did you run the ODAC installer, OUI or xcopy, or did you just copy over Oracle.DataAccess.dll to the new machine? If the latter, then you need to run the installer to put in all the necessary Oracle DLLs ODP.NET references.

  • PDF Export = System.DllNotFoundException: Unable to load DLL 'T2Embed': Access is denied

    Hello,
    I am using the ReportViewer over asp.net pages on a web hosting service.  I am generating the reports independently of the 'Sql Reporting Services' windows service.  In fact I have 'Sql Report Services' service turned off.
    All export works okay when I test the report in IIS7 on my local machine and in Visual Studio.  After I FTP the web application to the remote web host the report still works but only the Excel exports properly.  The export to PDF or Word generates
    the error
    System.DllNotFoundException: Unable to load DLL 'T2Embed': Access is denied
    Other people have had this problem too but their remedy is to run cacls.exe and fidget around with t2embed.dll.  Maybe that will work for a local client machine but that is not something I can do on a web hosts server.  They seem to think the font
    has security issues and a hotfix may be causing it.  The next thing I will try will be to use a generic font in my report like Arial or Courier but I doubt that will fix it. 
    Any clues?

    Hi Dulal,
    Please try to check the permission on "T2Embed" file, which is located in the C:\WINDOWS\system32 and C:\Windows\SysWOW64
    In addition, here is a similar thread about this topic for your reference. Please see:
    http://forums.asp.net/t/1933880.aspx
    Hope this helps.
    Regards,
    Elvis Long
    TechNet Community Support

  • Unable to load DLL 'OraOps10w.dll'

    I am getting a strange error in a production environment. I have a service that is written in .NET and is using ODP. Everything with the service is running fine, but we are getting the following error when running one specific stored procedure:
    Unable to load DLL 'OraOps10w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    The stored procedure is actually executing without error, but this error is occurring in .NET. It has all of a sudden started happening on us yesterday and we have tried to restart the service and also rebooted the server. The DLL does exist on the server and we verified it has the proper security. I am very puzzled by this, because everything appears to be working as normal.
    Any help is appreciated to try and troubleshoot this problem.
    Thanks!

    Hello,
    Please see this thread:
    Re: After upgrading to ODP.NET 10.1.0.400 existings Apps fail.
    This is almost always a permissions issue.
    - Mark

  • Unable to load DLL 'librfc32.dll'  (Exception from HRESULT: 0x8007007E)

    Unable to load DLL 'librfc32.dll'  (Exception from HRESULT: 0x8007007E)
    Hi!
    We would like to hold the account balance data from EMPTOR to SAP and have the following error:
    Unable to load DLL 'librfc32.dll'  (Exception from HRESULT: 0x8007007E)
    We use SAP ERP 2005 on Windows 64 Bit.
    Can some one help with the problem?
    Thank you very much!
    regards
    Thom

    You can download the latest avaiable kernel or just the librrfc component from http://service.sap.com/swdc. They maybe an issue with this DLL. Just download the latest one and copy into \usr\sap\<SID>\SYS\exe\run directory. Be sure to save the previous DLL.
    Thanks
    Adil

  • Unable to load DLL 'OraOps10w.dll': Access is denied.

    Below is our error message. This happens around 5 - 7AM daily, and we are struggling with identifying the root cause. It's hard for me to believe it's code related, but anything's possible. Still, what's odd is the app runs fine for a day then an IIS reset is done and everything is fixed. Is there any way this could be related to code and has anyone dealt with this error before? Could a job or some permission being run behind the scenes be using this same dll and cause it to be overwritten?
    Thanks, Bryan
    Timestamp: 3/4/2010 12:11:23 PM
    Message: HandlingInstanceID: 3d9a795c-1256-44c1-b018-f553d4023b12
    An exception of type 'System.TypeInitializationException' occurred and was caught.
    03/04/2010 07:11:23
    Type : System.TypeInitializationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : The type initializer for 'Oracle.DataAccess.Types.OracleDecimal' threw an exception.
    Source : Oracle.DataAccess
    Help link :
    TypeName : Oracle.DataAccess.Types.OracleDecimal
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Void PostBind_Int32()
    Stack Trace : at Oracle.DataAccess.Client.OracleParameter.PostBind_Int32()
    at Oracle.DataAccess.Client.OracleParameter.PostBind(OracleConnection conn, OpoSqlValCtx* pOpoSqlValCtx, Int32 arraySize)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
    at Oracle.DataAccess.Client.OracleCommandBuilder.DeriveParameters(OracleCommand command)
    at Microsoft.Practices.EnterpriseLibrary.Data.Odp.OdpDatabase.DeriveParameters(DbCommand discoveryCommand)
    at Microsoft.Practices.EnterpriseLibrary.Data.Database.DiscoverParameters(DbCommand command)
    Additional Info:
    MachineName : MISTERC
    TimeStamp : 3/4/2010 12:11:23 PM
    FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3f0a163eed2abd49
    ThreadIdentity :
    WindowsIdentity : NT AUTHORITY\NETWORK SERVICE
    Inner Exception
    Type : System.DllNotFoundException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : Unable to load DLL 'OraOps10w.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    Source : Oracle.DataAccess
    Help link :
    TypeName :
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Int32 AllocValCtxFromNoFmtStr(System.String, IntPtr ByRef)
    Stack Trace : at Oracle.DataAccess.Types.OpsDec.AllocValCtxFromNoFmtStr(String numStr, IntPtr& numCtx)
    at Oracle.DataAccess.Types.OracleDecimal.GetMaxValue()
    at Oracle.DataAccess.Types.OracleDecimal..cctor()

    Thanks a lot.
    I give permissions to ASP.NET account in directory C:\Oracle\product\10.2.0\client_4 (full control) and the application running ok.

  • Unable to load DLL "OraOps10.dll"

    I am running into peculiar issue. I am developing a windows based application which connects to Oracle database.
    For initial testings, I have created installer and tested on different machines that I have. Each machine has Oracle Client installed and I did not see any problem in running application.
    But when I share this installer with customer, he is getting error "Unable to load DLL OraOps10.dll". When asked he mentioned and has shown the Oracle Client installed on his machine and he is able to run other C# applications which connects to Oracle databases.
    I do not understand why my application only getting above error. I even tried suggestions shared at One way to fix the "Unable to load DLL (OraOps.dll)" error but still no luck.
    I even tried copying executables & DLLs manually on customer's machine. But still facing same issue.
    So please help me on what else i can do.
    Thanks & Best Regards
    Sudhakar Chavali
    P.S:
    I am using Windows XP operating system and customer is also using same operating system. Both machines are of type 32 bit OS only.
    This is the location where customer's oracle client installed: C:\oracle\product\10.2.0\client_1\bin and same is the version in my case too.
    We both are using Oracle 10g and .Net framework installed is 4.0

    The only thing that comes to mind is a .net version problem. Are you both using Oracle client 10g as well? Do you have an 11g client on your development machine?
    There was no .net 4 assemblies in the 10g client, they didn't add that until 11. It's possible that something in his configuration isn't letting a .net 4 application load a .net 2 assembly.
    If that's the case, then giving the client an Oracle 11g client will fix the problem.

  • Unable to Load DLL (oci.dll)

    I am trying to connect to Oracle 10g database using Visual Studio.Net 2003, System.Data.OracleClient namespace. I have created a Web service running on my workstation's local web server, that uses a connection to an Oracle database (my connctionString="Data Source=orcl;User Id=myid;Password=pswd" ). While the program trying to execute myConnection.Open() - it is receiving the error "Unable to load dll (oci.dll)". I have installed the Oracle client on a development (WinXPPro) workstation, so the client BIN directory is visible, production server is running Oracle 10g on Windows 2003.
    Is it some kind of connection string issue or user permission problem? How do I setup the right ones?
    Thanks for the help in advance!!

    Hi Justin,
    Thanks for your response.
    Yes, I can connect to the database using both Aqua Data Studio or SQL *Plus. I even can connect to the database from Visual Studio utilizing Data Link Properties utility via OLE DB drivers either from Microsoft or Oracle. The credantials I am providing in the last case are the same as I use in my connection string: data source name (tnsname) - orcl, user id and password...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Unable to load DLL (OraOps9.dll)

    I am trying to use a Web Service to access Oracle database using ODP.NET from download OraWin9204.exe.
    The Web Service is running on Server 2003 under the (usual) principle "NT AUTHORITY\NETWORK SERVICE" which has read/execute/list folder permissions on the entire C:\oracle folder on the web server.
    Client returns the error "Unable to load DLL (OraOps9.dll)"
    The Web Service has a AssemblyKeyFile that is trusted by the client.
    Any Ideas?

    OK. Got it working. Had tried all the stuff in previous posts (PATH/ Restart IIS/ Permissions)
    Rebooting the Server fixed it. I hope no-one else wastes a day on something that could have been documented!

  • Unable to load DLL 'OraOps10.dll with a twist

    Hi,
    So, I have been struggling with an issue for the last couple of weeks that is sending my mad. I receive the following error when attempting to make a connection to a database with my web app:
    Error message:
    "Unable to load DLL 'OraOps10.dll': The specified module could not be found. (Exception from HRESULT: (0x8007007E)"
    I am using
    Windows 2008 32bit
    Oracle Client 11g
    .net v2
    IIS7
    My apps called CMA, slimier to a more well known app NCSuite
    My connection to the database seems to working doing a simple test with a .udl file.
    I have attempted the following:
    Full re-installing the Oracle drivers following online instruction to clear reg and assembly, several times
    Setting permissions on the folder to beyond what they should be
    Setting permissions on any folder that refers to oracle
    Tried installing ODP.NET just on the off chance it might help
    Had a good mess to see if it was something to do with the 64bit issue, but obviously not as Im 32bit
    Unfortunately earlier version of the Oracle client are not compatible
    One thing that confuses me is why my app would refer to OraOps10.dll rather than the OraOps11w.dll thats being used. Only Oracle 11g has ever been installed on this machine as its a fresh build. The application itself does not directly refer to the OraOps10.dll.
    Any thoughts?
    Regards

    Hi,
    I'm a bit confused by your statement "+Tried installing ODP.NET just on the off chance it might help+". You can only get that error if you're using ODP.NET in the first place. A UDL file would test an oledb connection, so it's good just to make sure the client libraries are there and tnsnames configured correctly, but otherwise a bit irrelevant to this error.
    Anyway, that error occurs when ODP either cant find it's dependencies.. either the right OraOps or client dlls, or finds them but finds the wrong ones. OraOps11 (without the 'w') gets loaded when your application loads the 1.x ODP.NET provider. The provider for .net 2.x and higher loads oraops11w.dll.
    The usual cause of this error is from apps including Oracle.DataAccess.dll in the app bin directory, rather than letting it get picked up from the GAC.
    I'd start by
    1) searching your machine for all Oracle.DataAccess.dll, and rename any outside the Oracle home and/or GAC.
    2) if that doesnt do it, use a tool like Process Explorer (http://sysinternals.com) to find out where Oracle.DataAccess.dll is being loaded from, and what version. You need to have a matching OraOps that is the same version as Oracle.DataAccess.dll they actually need to be a matched pair (check the date of the dlls), but its the mismatched version that causes the error.
    3) if neither of the above help, use Process Monitor to watch the dll's loaded 'live' to see if there is some sort of permissions issue, but the well known permissions issue that you've probably found information about was specific to 9.2 and 10.2 client, and is not an issue with 11g. That is to say, the OUI sets permissions properly in 11g, but it's still possible an IIS admin may have cranked permissions down too tight.
    Additionally,
    1) What version of ODP was your app compiled with?
    2) What version of .NET framework?
    3) What version of 11g client do you have installed, and what did you install it from? ie, 11107.0 full client? or 11107.20 odac bundle?
    4) The ODP forum is located here: ODP.NET
    Hope it helps,
    Greg

  • Unable to load DLL 'oramts.dll'

    Hi All,
    We are using .NET 2005 as for development.
    Database Configuration : Oracle 10g R2 on Windows 2003(32 bit)
    We tried to implement Transactionscope it's given an error
    *'System.DllNotFoundException: Unable to load DLL 'oramts.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).'*

    Refer to this site for solution
    http://support.microsoft.com/kb/843044
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • System.DllNotFoundException: Unable to load DLL 'OraOps10.dll'

    Hello,
    I'm developing a piece of software for a small business that connects to an Oracle 10g express database I set up. The software is written in c# with VS2008, and has ODP.NET installed. On the computer I'm developing with, the software works perfectly. Unfortunately, when I try to use it on a different computer I get the error message "System.DllNotFoundException: Unable to load DLL 'OraOps10.dll'".
    I have already created a redistributable for all the .NET components I need, including Oracle.DataAccess.dll
    I think this problem would be solved by installing VS2008 and ODP.NET on every computer needing it, but that's unrealistic. Is there another way to get this program to work?

    Hi,
    At a minimum, you need to install the Oracle core client and ODP provider on the target deployment machine. ORAOPS10.dll is a the unmanaged layer for our provider and gets installed when you install the driver from our installation bundles. That DLL is a dependency of the .NET 1.x assembly and should get installed when you install the ODP component.
    I am assuming you are using an older 10.2.0.10 version. In later versions we provide an IC bundle that includes an xcopy redistributable that makes it alot easier to wrap up with your custom install scripts, with earlier versions that reply on a full client you need to use the OUI and install the client and ODP on the target machines where the app will be deployed.
    HTH
    Jenny B.

  • Instalation and Error Message: "Unable to load DLL(OraOps10.dll)"

    Hi, I'm not sure if my question is for this forum, but maybe :)
    I create very simple application in VS.NET using ODP.NET (see attachment) which just try to connect to oracle database. But when I install this project on different computer without Visual Studio (but Redistribute Package .NET Framework 1.1 is installed!!!) and with database Oracle 8.1.7 an error message occurred:
    "Unable to load DLL(OraOps10.dll)"
    How can I create some Install project in VS using ODP.NET that can run on other PC ???
    How can I solve this problem with loading DLL???
    Thanx, Tomas

    Tomas,
    You will need the Oracle Data Provider for .NET to be installed on the new machine.
    Thanks,
    Christian

  • Microsoft Visual Studio - Unable to load DLL 'librfc32.dll'

    Hi,
    I'm experiencing the following problem:
    When trying to establish a connection between SAP BPC MS and our SAP NW BW system.
    I've created a new Integration Services project in Business Intelligence Development Studio. The issue comes up when I try to test the connection:
    TITLE: Microsoft Visual Studio
    Unable to load DLL 'librfc32.dll':
    This application has failed to start because the application configuration is incorrect.
    Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
    I've placed the librfc32.dll library file on C:\WINDOWS\system32\.
    I ran R3DLLINS.EXE according to Note 684106 - Microsoft runtime DLLs.
    This placed all the needed dll library files (msvcr71.dll, msvcp71.dll, mfc71.dll, mfc71u.dll) on the correct path (C:\WINDOWS\system32\).
    I keep getting the same error.
    Platform:
    Windows 2003 R2 SP2 32-Bit
    MS SQL Server 2008 SP1
    SAP BPC 7.0 Microsoft Platform
    I've checked out some other posts on SDN but it didn't solve my problem:
    Re: librfc32.dll not found on Windows Server 2003
    LIBRFC32.DLL not Found Error
    Re: librfc32.dll
    Any ideas?
    Thank you.
    Bruno Pereira
    Edited by: Bruno Pereira on Mar 23, 2010 5:34 PM
    Edited by: Bruno Pereira on Mar 23, 2010 5:36 PM

    I was able to work it out.
    For your reference:
    Issue arrises from the fact that Business Intelligence Development Studio isn't able to load the librfc32.dll without the [Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update |http://www.microsoft.com/downloads/details.aspx?familyid=766a6af7-ec73-40ff-b072-9112bab119c2&displaylang=en#filelist]implemented on the system.
    Reference SAP note:
    [Note 684106 - Microsoft runtime DLLs|https://service.sap.com/sap/support/notes/684106]
    Bye!
    Bruno Pereira

Maybe you are looking for