I have an application build from Visual Studio 8 that is using the System.Oracle.DataAccess library to talk to an Oracle DB. This dll is version 2.111.6.20 x86 version.
When I run the application from Visual Studio, it connects, queries and displays the results correctly. This app is running on an Intel Xeon xw8600 processor using XP 2002.
But when I deploy this app on an IIS web server that is running on an AMD processor using Windows 2003 server x64, I get the following error:
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.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity,
Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, Visual Studio is running as a 32 bit application. I also
installed ODAC Client 11.1.0.6.21 and win32_11gR1_client.zip for the Oracle Developer's Tools and Client.
I also tried installing the same Oracle Client and Developer's Tools along with VStudio onto the my Windows 2003 server and my app ran fine running under the Visual Studio environment. But when I deployed the app onto the IIS server, I got the same type
of error using Oracle.DataAccess version2.111.6.20 x86 version. I then copied over a 64bit version of this dll (version 2.111.6.0 AMD64) and rebuilt /redeployed the app got a different kind of error.
[Exception: OCIEnvCreate failed with return code -1 but error message text was not available.] System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) +736 System.Data.OracleClient.OciEnvironmentHandle..ctor(MODE
environmentMode, Boolean unicode) +41 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +214 System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString
connectionOptions) +157
So all I'm trying to do is to get my app working in an IIS environment. It works when I run it under the VStudio environment on both my client box (x86) and server (x64).
george.lee44
0 Points
3 Posts
BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess'
Nov 19, 2009 09:35 PM|LINK
I have an application build from Visual Studio 8 that is using the System.Oracle.DataAccess library to talk to an Oracle DB. This dll is version 2.111.6.20 x86 version.
When I run the application from Visual Studio, it connects, queries and displays the results correctly. This app is running on an Intel Xeon xw8600 processor using XP 2002.
But when I deploy this app on an IIS web server that is running on an AMD processor using Windows 2003 server x64, I get the following error:
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.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, Visual Studio is running as a 32 bit application. I also installed ODAC Client 11.1.0.6.21 and win32_11gR1_client.zip for the Oracle Developer's Tools and Client.
I also tried installing the same Oracle Client and Developer's Tools along with VStudio onto the my Windows 2003 server and my app ran fine running under the Visual Studio environment. But when I deployed the app onto the IIS server, I got the same type of error using Oracle.DataAccess version2.111.6.20 x86 version. I then copied over a 64bit version of this dll (version 2.111.6.0 AMD64) and rebuilt /redeployed the app got a different kind of error.
[Exception: OCIEnvCreate failed with return code -1 but error message text was not available.] System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) +736 System.Data.OracleClient.OciEnvironmentHandle..ctor(MODE environmentMode, Boolean unicode) +41 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +214 System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +157
So all I'm trying to do is to get my app working in an IIS environment. It works when I run it under the VStudio environment on both my client box (x86) and server (x64).
Can anyone help me on this?
Thanks in advance....
IIS6.0 IIS 6.0
alaa.cs
Member
2 Points
1 Post
Re: BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess'
Feb 01, 2012 08:44 AM|LINK
Any solutions to this problem?? I have got the same problem
kratos_Vimal
Contributor
3744 Points
960 Posts
Re: BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess'
Feb 01, 2012 08:47 AM|LINK
try ading the dlls manually .. that is copy them from your code and add them to the published bin folder
Vimal
palasataja
Member
2 Points
2 Posts
Re: BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess'
Dec 18, 2012 12:35 PM|LINK
Hi!
I've struggled with this error for half a day. Thats what helped me:
For x64 machine:
1. Find Oracle.DataAccess.dll in GAC (C:\Windows\Microsoft.NET\assembly\GAC_32\Oracle.DataAccess\)
2. Copy to your dependencies folder (if any)
3. Rebuild your project and copy dll to output dir