3
votes

I am using ODP.NET in my asp.net project in order for the application to talk to oracle 11 g Express on Windows 2008 server (32 bit). While on development machine I had Windows 7 (32 bit). I installed Windows 8 (64 bit) on the development machine and tried to run the application from visual studio 2012, It gave the error 'Could not load file or assembly 'Oracle.DataAccess''. After a little search I realized that I have to install ODP.NET (64 bit) in order to use it on 64-bit machine, so I uninstalled the 32 bit version and installed 64-bit ODP.NET. Removed the reference to old Oracle.DataAccess but still facing the same issue. Am I missing something??

3
Are you sure ODP.NET yet supports windows 8? oracle.com/technetwork/database/windows/tech-info/… The paper states it will from 11.2.0.4 onwards. The latest I can find is 11.2.0.3.20. Also you could check if your application is running as x64 or x32 process. The bitness has to be the same as your ODP.NET driver you're planning to use.Alex
@Alex thanks.. nice point.. you are very much right I should have checked whether ODP.NET is supported by Windows 8ZedBee
Can also change your application's target platform from AnyCPU to x86. This will make it always run as 32bit x86 so it will then load the 32bit client libraries etc.Brian
did you try fusionlog? see for example mhttp://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx ?evgenyl

3 Answers

3
votes

I had the same issue and after some trial and error I found that the issue is with 32 bit vs 64 bit platform.

  1. When we deploy 32 Bit Oracle.DataAccess.dll along with web application over 64 bit environment and ODP.net installed over server this error will occur.
  2. One solution is to delete the Oracle.DataAccess.dll from bin folder and correct reference will be auto resolved.
  3. Second solution is to set the reference property CopyToLocal=false for Oracle.DataAccess.dll and hence it wont go with build when you deploy on IIS and error will not occur.
  4. Third solution which I will prefer is to enable 32 bit applications for your application pool and you wont face this issue again irrespective of whether Oracle.DataAccess.dll is present in bin folder or not.

Hope this helps..

1
votes

To install ODP.NET, I use 64bit ODAC
After installing it, to check if Oracle.DataAccess 64bit assembly is properly installed go to folder: c:\Windows\Microsoft.NET\assembly\GAC_64 and check if Oracle.DataAccess folder is present there.
In the folder there should be a subfolder containing the version of Oracle.DataAccess dll you are using.

In Visual Studio, you must add the reference by looking in Assemblies->Extensions (not by using Browse)
Also check your build configuration in Visual Studio to make sure that your application's active solution platform is 64 bit.

To run your website, you must use IIS since visual studio's development server only run in 32 bit mode.
In IIS application pool, set your application to run in 64 bit. (The setting is in advanced settings)

0
votes

The bit-ness of the machine does not matter - the bit-ness of the hosting application does. The development web server included with Visual Studio is 32 bit, consequently you'd need to install the 32 bit version of odp.net. You could run it in IIS instead if you wanted to test with the 64 bit version. I install both.

In this case, I'd guess the problem is more likely to be version number -your application originally referenced a different version than the one you've installed. The simple thing to do is delete/re-add the reference to the newly installed Oracle.DataAccess.dll. However the fact that you have to do this somewhat indicates that you are installing the full client instead of just the ODP.net install. For some reason (other than the oracle universal installer being a total hunk of junk), the full client does not include the publisher policy (which would redirect the reference), but the odp.net install does.