How to Make ODP.NET 4.0 (64 bit) working on 64 bit machine Windows 7?

假装没事ソ 提交于 2019-12-03 09:05:37

The best possibility to handle this is to use the x86 version locally with Visual Studio and x64 version on the server with IIS. To do this you have to download both versions - copy one in folder lib\x86 and the other in lib\x64 After this you have to modify the project file(s) - visual studio supports conditional references. Add following section to your project file:

<PropertyGroup>
     <ReferencesPath Condition=" '$(Platform)' == 'x86' ">..\Lib\x86</ReferencesPath>
     <ReferencesPath Condition=" '$(Platform)' == 'x64' ">..\Lib\x64</ReferencesPath>
</PropertyGroup>

After this reference the odp.net assmebly like this:

<Reference ... processorArchitecture=$(Platform)">
   <SpecificVersion>False</SpecificVersion>
   <HintPath>$(ReferencesPath)\Oracle.DataAccess.dll</HintPath>
   <Private>True</Private>
</Reference>

This way when you can build locally as x86 and on the server x64 and always the correct version of Oracle.DataAccess.dll will be referenced.

Alternatively if you only want to use the x64 version than you have to stick to IIS even you work locally OR you could try to run the open source version of Cassini in x64 mode (http://cassinidev.codeplex.com).

For me the best possibility is to reference both versions as described above - this has been working fine for everyone on my team for a while now.

You must install 64-bit Oracle Data Access Components (ODAC) since the Oracle Client Installation doesn't register Oracle.DataAccess.dll into the assembly.

If your oracle data access installation is OK, everything should work after unchecking "Enable 32 bit applications" in your Application Pool settings.

If you still have the same error, it is possible that you have a 32 bit dll in your bin folder of the website. Just delete it and the website will use the 64 bit from the assembly and it should work.

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