Oracle DataAccess Error — oracle-tech

    Forum Stats

  • 3,715,997 Users
  • 2,242,925 Discussions
  • 7,845,725 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Oracle DataAccess Error

IQ
IQ Member Posts: 751
edited March 2020 in ODP.NET

Hello,

We are using Oracle Database 10g  10.2.0.4.0 64bit Production on a Windows 2019 server. I have IIS configured and I am trying to run an application which uses Oracle Database at the backend. I get an error which is shown below, I have installed all the latest ODP packages that were required with the installation. Can someone advise how to resolve this issue ?

Thanks

IQ

"

Line 80: <add assembly="Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89B483F429C47342"/> Line 81: <!-- <add assembly="Oracle.ManagedDataAccess.Client, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>--> Line 82: <!-- <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

Source File: C:\inetpub\wwwroot\TMS\web.config    Line: 80

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

"

IQ

Best Answer

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited March 2020 Accepted Answer

    The incorrect format indicates a bitness difference. You pulled in 32-bit ODP.NET when your app is running in 64-bit .NET Framework. Or 64-bit ODP.NET in 32-bit .NET Framework.

    If you don't have a particular reason to use unmanaged ODP.NET, I would recommend using managed ODP.NET (Oracle.ManagedDataAccess.dll). It's much easier to configure since it's (usually) a single DLL you have to deploy.

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited March 2020

    The "Assembly binding logging is turned OFF" message is the warning. There should be an error or exception message as well, which will point to the ODP.NET issue. Can you post that error or exception message?

    IQIQ
  • IQ
    IQ Member Posts: 751
    edited March 2020

    This is the error message

    "

    Configuration Error  

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

    Parser Error Message: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

    Source Error:

    Line 78:         <add assembly="System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> Line 79:         <add assembly="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> Line 80:         <add assembly="Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89B483F429C47342"/> Line 81:          <add assembly="Microsoft.Office.Interop.Access.Dao, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/> Line 82:         <add assembly="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
      


    Source File: C:\inetpub\wwwroot\TMS\web.config    Line: 80       

    "

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited March 2020

    Did you add Oracle.DataAccess.dll to your project after installation? If so, was it version 4.121.2.0?

  • IQ
    IQ Member Posts: 751
    edited March 2020

    Hi Alex,

      The oracle.dataaccess.dll  file was not in my Projects\bin folder, I copied it over from the folder C:\windows\microsoft.net\assembly\gac_32\Oracle.DataAccess\v4.0_4.121.2.0__89b483f429c47342   but now I get a different  error, see below,

    Could not load file or assembly 'oracle.dataaccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.  

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.BadImageFormatException: Could not load file or assembly 'oracle.dataaccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  


    Assembly Load Trace: The following information can be helpful to determine why the assembly 'oracle.dataaccess' could not be loaded.

    WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 
      


    Stack Trace:

    [BadImageFormatException: Could not load file or assembly 'oracle.dataaccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +478 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +128 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21 System.Reflection.Assembly.Load(String assemblyString) +34 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48  [ConfigurationErrorsException: Could not load file or assembly 'oracle.dataaccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +767 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +256 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +58 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +281 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +69 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +137 System.Web.Compilation.BuildManager.ExecutePreAppStart() +172 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +848  [HttpException (0x80004005): Could not load file or assembly 'oracle.dataaccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +113 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +1138 
  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited March 2020 Accepted Answer

    The incorrect format indicates a bitness difference. You pulled in 32-bit ODP.NET when your app is running in 64-bit .NET Framework. Or 64-bit ODP.NET in 32-bit .NET Framework.

    If you don't have a particular reason to use unmanaged ODP.NET, I would recommend using managed ODP.NET (Oracle.ManagedDataAccess.dll). It's much easier to configure since it's (usually) a single DLL you have to deploy.

  • IQ
    IQ Member Posts: 751
    edited March 2020

    Hi Alex,

    Thanks for all your help and useful suggestions. I fully agree with your suggestions. Our is a legacy application so we are not changing many of the existing configurations, in this case after your suggestion , I managed to change the Application Pool to accept 32 bit applications and it is now working, we are able to run this application without any issues.

    Appreciate your help.

    Regards

    IQ

Sign In or Register to comment.