Forum Stats

  • 3,770,488 Users
  • 2,253,125 Discussions
  • 7,875,484 Comments

Discussions

Oracle.DataAccess Issue with .net and 64 bit

2636537
2636537 Member Posts: 6
edited Mar 25, 2014 4:09AM in ODP.NET

Server Error in '/' Application.


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



Windows 7 - 64.bit

ODAC121012Xcopy_x64 is installed on mahcine.

Added reference to Oracle.DataAccess.dll located @ C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\oracle.dataaccess.dll



Also Modified the Web config as shown below


<dependentAssembly>

        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" culture="neutral" />

        <bindingRedirect oldVersion="4.102.0.0-4.120.0.0" newVersion="4.121.1.0" />

</dependentAssembly>

.....

<system.data>

    <DbProviderFactories>     

      <add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory,            Oracle.DataAccess, Version=4.121.1.0, Culture=neutral,   PublicKeyToken=89b483f429c47342" />

    </DbProviderFactories>

  </system.data>

...........

<providers>    

      <provider invariantName="Oracle.DataAccess.Client" type="Oracle.DataAccess.Client.OracleClientFactory,  Oracle.DataAccess, Version=4.121.1.0, Culture=neutral,            PublicKeyToken=89b483f429c47342" />

    </providers>

Gac Details

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>gacutil /l | findstr Oracle.DataAccess

  Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=de, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=es, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=fr, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=it, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=ja, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=ko, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=pt-BR, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=zh-CHS, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=2.121.1.0, Culture=zh-CHT, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Policy.2.102.Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Policy.2.111.Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Policy.2.112.Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Oracle.DataAccess.resources, Version=2.112.2.0, Culture=ja, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Oracle.DataAccess.resources, Version=2.112.2.0, Culture=zh-CHS, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Policy.2.112.Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=de, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=es, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=fr, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=it, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=ja, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=ko, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=pt-BR, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=zh-CHS, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess.resources, Version=4.121.1.0, Culture=zh-CHT, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Policy.4.112.Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

  Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Oracle.DataAccess.resources, Version=4.112.2.0, Culture=ja, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Oracle.DataAccess.resources, Version=4.112.2.0, Culture=zh-CHS, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

  Policy.4.112.Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

Still the issue is not resolved.

Tagged:

Best Answer

  • 2636537
    2636537 Member Posts: 6
    edited Mar 25, 2014 4:09AM Accepted Answer

    Thank you Alex for the providing the useful information..

    The Stack trace is as follows

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


    === Pre-bind state information ===

    LOG: DisplayName = Oracle.DataAccess

    (Partial)

    WRN: Partial binding information was supplied for an assembly:

    WRN: Assembly Name: Oracle.DataAccess | Domain ID: 8

    WRN: A partial bind occurs when only part of the assembly display name is provided.

    WRN: This might result in the binder loading an incorrect assembly.

    WRN: It is recommended to provide a fully specified textual identity for the assembly,

    WRN: that consists of the simple name, version, culture, and public key token.

    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.

    LOG: Appbase = file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/

    LOG: Initial PrivatePath = D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\bin

    Calling assembly : (Unknown).

    ===

    LOG: This bind starts in default load context.

    LOG: Using application configuration file: D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\web.config

    LOG: Using host configuration file:

    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

    LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess.DLL.

    LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess/Oracle.DataAccess.DLL.

    LOG: Attempting download of new URL file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/bin/Oracle.DataAccess.DLL.

    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

    Based on

    LOG: Initial PrivatePath = D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\bin

    Calling assembly : (Unknown).


    I got the solution.


    The above statement tells that the it is trying to load the dll from the bin directory and that is Unknown. When i deleted dll from the bin directory application strated to use the dll from the gack and issue get resolved.

Answers

  • 2636537
    2636537 Member Posts: 6

    I am getting above issue while working on the web application in vs-2012. I have also installed the Oracle 11g on the machine. I had tried many options but not able to resolve the issue.

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,968 Employee

    Did you run the entire ODP.NET xcopy install batch script? Did you copy over all the required files?

    ODP.NET, Unmanaged Driver, relies on more than Oracle.DataAccess.dll being installed and configured.

    If you answer yes to the above questions, Process Explorer from Sysinternals can tell you what DLL is trying to be loaded, but missing or can't be found.

  • 2636537
    2636537 Member Posts: 6
    edited Mar 24, 2014 1:51AM

    Yes I have installed the ODP.NET XCopy over all required files using following command. install.bat all c:\oracle odac Using Process Explorer I have observed 2 things

    1. On 32bit Machine 

    When I searched referenced dll, It is showing the "Oracle.DataAccess" in references.

    But

    2. On 64 bit      

    When I searched referenced dll, It is showing the "oracle.manageddataaccess.dll" in references. Gac Dll Path for reff.

    C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\oracle.dataaccess.dll C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle.ManagedDataAccess\v4.0_4.121.1.0__89b483f429c47342\oracle.manageddataaccess.dll

    Server Error in '/' Application.


    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.

  • 2636537
    2636537 Member Posts: 6
    edited Mar 24, 2014 8:57AM

    After some time i installed the ODAC121012 x86(32) bit version after that restarted machine.

    Now able to connect to Oracle DB through the connection wizard of the server explorer in visual studio

    2012

    In IIS

           -> for each Application Pool

                                                    -> Enable to run in 32 bit flag is marked to true.

    but still getting above exception when i run the web application.

    My Os is Window 7 64bit

  • 2636537
    2636537 Member Posts: 6
    edited Mar 24, 2014 8:55AM

    Stack Trace

    Server Error in '/' Application.


    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.

    === Pre-bind state information === LOG: DisplayName = Oracle.DataAccess (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: Oracle.DataAccess | Domain ID: 7 WRN: A partial bind occurs when only part of the assembly display name is provided. WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. LOG: Appbase = file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/ LOG: Initial PrivatePath = D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\bin Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\web.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess.DLL. LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess/Oracle.DataAccess.DLL. LOG: Attempting download of new URL file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/bin/Oracle.DataAccess.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. 


    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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38  [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) +752 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285 System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516  [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) +9915300 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456 



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446



    Also tried by modifying the web config file

        <dependentAssembly>

            <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>

            <bindingRedirect oldVersion="4.100.0.0" newVersion="4.121.1.0" />

          </dependentAssembly>

    Gac listing is as follows:

    C:\Windows\system32>gacutil /l Oracle.DataAccess

    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17929

    Copyright (c) Microsoft Corporation.  All rights reserved.

    The Global Assembly Cache contains the following assemblies:

      Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

      Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

      Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

    Number of items = 3

    C:\Windows\system32>

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,968 Employee

    Usually, the bad image format error is due to 32-bit Oracle.DataAccess.dll is trying to load 64-bit Oracle Client DLLs or the other way around. This problem is also known as DLL Hell. To resolve this, use the DllPath setting to tell each Oracle.DataAccess.dll where to find its dependent DLLs in the correct format.

    Here's more information on using DllPath.

    Alex Keh-Oracle
  • 2636537
    2636537 Member Posts: 6
    edited Mar 25, 2014 4:09AM Accepted Answer

    Thank you Alex for the providing the useful information..

    The Stack trace is as follows

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


    === Pre-bind state information ===

    LOG: DisplayName = Oracle.DataAccess

    (Partial)

    WRN: Partial binding information was supplied for an assembly:

    WRN: Assembly Name: Oracle.DataAccess | Domain ID: 8

    WRN: A partial bind occurs when only part of the assembly display name is provided.

    WRN: This might result in the binder loading an incorrect assembly.

    WRN: It is recommended to provide a fully specified textual identity for the assembly,

    WRN: that consists of the simple name, version, culture, and public key token.

    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.

    LOG: Appbase = file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/

    LOG: Initial PrivatePath = D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\bin

    Calling assembly : (Unknown).

    ===

    LOG: This bind starts in default load context.

    LOG: Using application configuration file: D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\web.config

    LOG: Using host configuration file:

    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

    LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess.DLL.

    LOG: Attempting download of new URL file:///C:/Users/sarage/AppData/Local/Temp/Temporary ASP.NET Files/root/16addc5f/816f47ab/Oracle.DataAccess/Oracle.DataAccess.DLL.

    LOG: Attempting download of new URL file:///D:/TFS/Woodland002/WoodFinInc/Presentation/Nop.Web/bin/Oracle.DataAccess.DLL.

    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

    Based on

    LOG: Initial PrivatePath = D:\TFS\Woodland002\WoodFinInc\Presentation\Nop.Web\bin

    Calling assembly : (Unknown).


    I got the solution.


    The above statement tells that the it is trying to load the dll from the bin directory and that is Unknown. When i deleted dll from the bin directory application strated to use the dll from the gack and issue get resolved.

This discussion has been closed.