Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies

MaahjoorMay 2 2014 — edited May 3 2014

Dear all,

The configuration related to my problem are below;

  1. Microsoft Windows 8 64 bits
  2. Microsoft Visual Studio Professional 2013
  3. DOT.Net framework 4.5
  4. Oracle Database 12c Release 12.1.0.1.0
  5. ODTwithODAC121012 (32bit) ---- i think problem is here, but there is no 64 bit odac which provide odp for vs2013.
  6. Microsoft Internet Explorer 10
  7. Latest version of IIS

i have created a simple application with Grid View control like below;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using Oracle.DataAccess.Client;

using Oracle.DataAccess.Types;

using System.Data;

using System.Configuration;

namespace WebApplication18

{

    public partial class WebForm1 : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            string oradb = "Data Source=pdborcl;User Id=PAKICON;Password=pakicon;";

            OracleConnection conn = new OracleConnection(oradb);

                   string sql = "select * from user_accounts";

            OracleCommand cmd = new OracleCommand(sql, conn);

            cmd.CommandType = CommandType.Text;

            cmd.Connection = conn;

            cmd.CommandText=sql;

            OracleDataAdapter da = new OracleDataAdapter();

            da.SelectCommand = cmd;

            DataSet ds = new DataSet();

     

                 conn.Open();

            cmd.ExecuteNonQuery();

            da.Fill(ds);

            conn.Close();

            GridView1.DataSource=ds;

            GridView1.DataBind();

                }

    }

}

when i try to run it, i receive this error on internet explorer page

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.


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: 2

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:///c:/users/administrator/documents/visual studio 2013/Projects/WebApplication18/WebApplication18/

LOG: Initial PrivatePath = c:\users\administrator\documents\visual studio 2013\Projects\WebApplication18\WebApplication18\bin

Calling assembly : (Unknown).

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: c:\users\administrator\documents\visual studio 2013\Projects\WebApplication18\WebApplication18\web.config

LOG: Using host configuration file: C:\Users\Administrator\Documents\IISExpress\config\aspnet.config

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:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/4e39ee31/273a2d26/Oracle.DataAccess.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/4e39ee31/273a2d26/Oracle.DataAccess/Oracle.DataAccess.DLL.

LOG: Attempting download of new URL file:///c:/users/administrator/documents/visual studio 2013/Projects/WebApplication18/WebApplication18/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.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Kindly guide me since i have searched a lot and practice, but failed.

thank you.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2014
Added on May 2 2014
6 comments
22,892 views