Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 25, 2012 11:18 PM by Lannie
Dec 23, 2012 09:26 PM|LINK
I want to connect from asp.net to oracle client 11g .I downloaded and setup ODAC 32 bit from this link .I added reference to Oracle.data.access.dll
in Visual studio 2012.When I execute my web program I encountered the same error.
Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. Geçersiz biçimdeki bir program yüklenmek istendi.
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 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.
And my code :
public partial class Home : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
string oradb = "Data Source=(DESCRIPTION="
+ "User Id=G;Password=G;";
OracleConnection conn = new OracleConnection(oradb);
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "select dname from dept where deptno = 10";
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
catch (Exception ee)
How can I solve this problem?Any suggestions?
Dec 23, 2012 10:43 PM|LINK
do you have an x64 pc?
Dec 23, 2012 11:09 PM|LINK
I have win 7 64bit pc and Visual studio 2012 64 bit.
Dec 24, 2012 06:50 AM|LINK
somewhere in the application pool properties you can configure to load 32 bit dlls.
Dec 24, 2012 08:20 AM|LINK
I configured the IIS application pool
like this .But nothing changed.I encounter same error.
Dec 25, 2012 03:18 AM|LINK
You have not specified the location of the Oracle database and version.
Installed on the same workstation/server as the IIS and VS 2012?
Installed on a remote workstation/server in an intranet environment?
If local, Oracle advises creating a Microsoft Loopback Adapter virtual LAN with STATIC IP, disabling temporarily all other network devices, and installing Oracle on the Loopback adapter static IP, and then enabling other network devices. Details in the
Oracle Windows Installation Guide.
If remote, how can you resolve the Win-XX host name?? It is better to use the static IP address of the database server for the host name.
If remote, software and hardware firewall must allow traffic on port 1521.
What version of ODAC was installed?
Dec 25, 2012 05:18 PM|LINK
I use Oracle Client 11g.I connect to Oracle server with specific ip range. I used same tnsnames(includes host=Wın-XX) for connect to db from sql developer so I succesfully connected the db.I installed the
this ODAC version.
Additionally I used the dll under the C:\Windows\Microsoft.NET\assembly\GAC_32\Oracle.DataAccess .Problem solved.but I dont understand why.
What is the oracle.access.data.dll difference between the C:\Windows\Microsoft.NET\assembly\GAC_32\Oracle.DataAccess and D:\app\product\11.2.0\client_6\odp.net\bin\4 ?
Dec 25, 2012 11:18 PM|LINK
I always put D:\app\product\11.2.0\client_6\odp.net\bin\4 ODAC dll directly in the project /BIN folder and make a local reference to it.
I just have had way less problems doing it this way, especially when moving from dev to test to production servers bypassing the GAC completely.