如何使ODP.NET 4.0(64位)在64位计算机Windows 7上运行? [英] How to Make ODP.NET 4.0 (64 bit) working on 64 bit machine Windows 7?

查看:66
本文介绍了如何使ODP.NET 4.0(64位)在64位计算机Windows 7上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Oracle提供的XCopy 11.2为64位计算机安装了Oracle Client(按照自述说明安装了所有内容).

I have installed the Oracle Client for the 64 bit machine using the XCopy 11.2 provided by Oracle (Installed everything as per the read me instructions).

我正在使用Visual Studio 2010,并且该项目的类型为ASP.NET网站.

I am using Visual Studio 2010 and the project is of type ASP.NET Website.

当我尝试使用上面安装的Oracle Connection执行ASP.NET网站时,.com在编译期间从web.config文件中给出了错误.

When I tried to execute my ASP.NET Website using the Oracle Connection installed above..it is giving me the error from the web.config file during compile time.

**

无法加载文件或程序集 'Oracle.DataAccess,版本= 4.112.2.0, 文化=中立, PublicKeyToken = 89b483f429c47342'或 它的依赖项之一.系统 找不到指定的文件"

"Could not load file or assembly 'Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified"

**

如果我在IIS应用程序池中将启用32位应用程序"的值更改为True,则该方法起作用.

It worked if I changed the value of Enable 32-Bit Applications to True in IIS App pool.

但是我的要求是使其在具有64位ODP.NET连接器的64位计算机上工作,因此我不想将启用32位应用程序"的值更改为True.

But my requirement is to make it work on 64 bit machine with 64 bit ODP.NET connector, So I do not want to change the value of Enable 32-Bit Applications to True.

所以,如果可以的话,请帮我找到一个答案,将不胜感激.请帮助我解决以上错误.

So, If you could please help me finding an answer that would be greatly appreciated. Please help me fixing the above error.

推荐答案

处理此问题的最佳方法是在Visual Studio本地使用x86版本,在带有IIS的服务器上使用x64版本. 为此,您必须下载两个版本-在文件夹lib \ x86中复制一个版本,在lib \ x64中复制另一个版本 此后,您必须修改项目文件-Visual Studio支持条件引用.将以下部分添加到您的项目文件中:

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>

在引用之后,odp.net如下所示:

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>

这样,当您可以以x86的本地版本和在x64的服务器上进行本地构建时,始终会引用正确版本的Oracle.DataAccess.dll.

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.

或者,如果您只想使用x64版本,那么即使您在本地工作,也要坚持使用IIS,或者可以尝试以x64模式运行Cassini的开源版本(http://cassinidev.codeplex.com)

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.

这篇关于如何使ODP.NET 4.0(64位)在64位计算机Windows 7上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆