Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to run this web application. I keep getting this error "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." 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." Below are the things that I already tried.

  1. replaced all the oracle dll's with 32 bit oracle dll i.e 2.112.3.0

I have 32 bit client installed on 64 bit machine. The operating system is windows 7.

  1. compile each individual project individually. Deleted all the oracle dependent files dll and then added the 2.112.3.0 dll's individually and then compiled each project

  2. Register the 32 bit dll on GAC using this statement gacutil /i %ORA_HOME4%\odp.net\bin\4\Oracle.DataAccess.dll

gacutil /i %ORA_HOME4%\asp.net\bin\4\oracle.web.dll

for the above two statements, I copied the gacutil.exe from c:\Program Files(x86)\Microsoft sdk\windows\v7.0A\Bin\NETFX4.0 Tools\X64 to C:\ drive and then

I executed the above two statement:

gacutil /i %ORA_HOME4%\odp.net\bin\4\Oracle.DataAccess.dll gacutil /i %ORA_HOME4%\asp.net\bin\4\oracle.web.dll when I executed the above two statements, I didn't get any message, I executed them in Dos windows under administrator privilege.

  1. I also deleted all the Temporary ASP.net files from this location

c:\windows\Microsoft.Net\V4.0.30319\temporary ASP.net files I also changed the web application build Platform target to X86, Originally, it was at "ANy CPU". out of frustration, I also tried changing the platform target to X64 and then I got the error message saying

" Cold not load file or assemble . webapp" or one of its dependencies. An attempt was made to load a program with an incorrect format.

I don't have IIS installed on my computer, I am running this application in visual studio 2010 so I think it will be using the inbuilt IIS that comes with visual studio.

I spend lot of hours resolving this issue, but still getting the same error again and again.

like image 722
Anjali5 Avatar asked Sep 13 '13 06:09

Anjali5


2 Answers

Try this: Open IIS Manager, change application pool's advance setting, change Enable 32 bit Application to false.

like image 73
user3048209 Avatar answered Sep 22 '22 20:09

user3048209


I found the solution with following steps:

  • remove the Oracle.DataAcces.dll reference,
    and add a fresh reference to:
    C:\windows\assembly\GAC\Oracle.DataAccess\X.XXX.X.XX__89b483f429c47342/oracle.dataaccess.dll
  • Make local copy= false.

Hope it helps

like image 27
Saikat Daripa Avatar answered Sep 22 '22 20:09

Saikat Daripa