Could not load file or assembly 'Oracle.DataAccess' 64 bit ODP.NET

梦想的初衷 提交于 2019-12-21 20:16:16

问题


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??


回答1:


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..




回答2:


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)




回答3:


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.



来源:https://stackoverflow.com/questions/16186661/could-not-load-file-or-assembly-oracle-dataaccess-64-bit-odp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!