无法在.NET中加载Oracle.DataAccess的文件或程序集 [英] Could not load file or assembly for Oracle.DataAccess in .NET

查看:177
本文介绍了无法在.NET中加载Oracle.DataAccess的文件或程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行一个简单的程序来访问oracle时,我会收到此消息

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

我检查了\ windows \ assembly,它在其中,但不在GAC(gacutil -l)中.我无法添加到GAC中(gacutil -i [path].我收到未知错误".

任何人都有相同的经历吗?

解决方案

我将为您提供我刚刚在64位操作系统Windows Server 2008 R2上所获得的答案.我获得的库应用程序套件是使用.net 3.5 x86和较早的DLL库开发的,由于我从oracle安装了较新的x64客户端,因此我陷入了困境.

我发现的是以下内容: 从Oracle中为Windows Server 2008安装最新的x64客户端.我相信这将是2.7.0客户端.选择安装时,请确保进行自定义并选择.NET库. 配置您的tnsnames文件并针对数据源测试tnsping.

接下来,如果您正在运行32位应用程序,请为32位安装相同版本的客户端.另外,请遵循相同的安装例程,并选择相同的主页.

完成后,您会发现您拥有一个带有两个客户端目录(Client1和Client2)的应用程序/产品.

如果导航到Windows/Assemblies目录,则会发现您对Oracle.DataAccess.dll(x2)的引用,其中一个用于x86,一个用于AMD64.

现在,根据您是否有开发人员或正在计算机上进行开发,在这里可能还可以,但是,如果他们使用的是较旧的驱动程序,则需要执行最后一步.

导航到app \ name \ product \ version \ client_1 \ odp.net \ publisher policy \ 2.x目录.这里包括两个策略文件.使用gacutil/i将Policy.2.111.Oracle.DataAccess.dll安装到GAC中.这会将旧的oracle ODP调用重定向到较新的版本.因此,如果有人使用10g客户端进行开发,那么现在它将可以与11g客户端一起使用.

仅供参考-有些人可能会安装带有2.111.7.20的最新ODP.NET.主oracle客户端本身带有2.111.7.0 ..我在7.20上没有取得任何成功,但在7.0客户端上没有任何问题.

When I try to run a simple program to access oracle I am getting this message

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

I checked \windows\assembly and it's in there, but it's not in GAC (gacutil -l). I can't add into GAC (gacutil -i [path]. I get 'unknown error'.

Anyone has the same experiencing?

解决方案

I'm going to give you the answers from what I've just went through on Windows Server 2008 R2 which is a 64 bit operating system. The application suite of libraries I was given were developed using .net 3.5 x86 with the older DLL libraries and I was stuck because I had installed the newer x64 clients from oracle.

What I found was the following: Install the latest x64 client from Oracle for Windows Server 2008. I believe this would be the 2.7.0 client. When you select the installation, make sure you do custom and select the .NET libraries. Configure your tnsnames files and test your tnsping against your data source.

Next, if you are running a 32 bit application, install the same version of the client for 32 bit. Also, follow the same installation routine, and select the same home.

When your finished, you will find that you have a single app/product with two client directories (Client1 and Client2).

If you navigate to the windows/assemblies directory you will find that you have a reference to the Oracle.DataAccess.dll (x2) with one for x86 and one for AMD64.

Now, depending on if you have developers or are developing on the machine yourself, you may be ok here, however, if they are using older drivers, then you need to perform one last step.

Navigate to the app\name\product\version\client_1\odp.net\publisher policy\2.x directory. Included in here are two policy files. use gacutil /i to install the Policy.2.111.Oracle.DataAccess.dll into the GAC. This will redirect legacy oracle ODP calls to the newer versions. So, if someone developed with the 10g client, it will now work with the 11 client.

FYI -- Some may be installing the latest ODP.NET with the 2.111.7.20. The main oracle client itself comes with 2.111.7.0 .. I've not had any success with the 7.20 but have no issues with the 7.0 client.

这篇关于无法在.NET中加载Oracle.DataAccess的文件或程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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