问题描述
我正在用 C# 构建 ASP.NET 应用程序,我想连接到 oracle 数据库.
我在我的 64 位 Microsoft Window Server 2008 机器上的应用程序中添加了对 Oracle.DataAccess
的引用.我还在我的机器上安装了 ODAC(Oracle 数据访问组件)并且 Oracle.DataAccess.dll
也出现在这个路径上
I am building ASP.NET application with C# and I want to connect to oracle database.
I have added reference to Oracle.DataAccess
in my application on my 64bit Microsoft Window Server 2008 machine.I also installed ODAC (Oracle Data Access Component) on my machineand Oracle.DataAccess.dll
is also present on this path
C:WindowsMicrosoft.NETassemblyGAC_64Oracle.DataAccess
但是当我尝试连接时遇到以下错误:
but when i'm trying to connect i encounter following error:
无法加载文件或程序集Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342"或其依赖项之一.系统找不到指定的文件.
推荐答案
据我所知,Oracle.DataAccess
程序集仅适用于 32 位,64 位我也有这种问题位,它真的不起作用.我的解决方案是从 GAC 中删除 64 位并在 GAC 上安装 32 位.我还将 bin 文件夹中的任何 .dll 文件删除到我的应用程序中,在 GAC 上找到该程序集.
As far as I know, the Oracle.DataAccess
assembly works only with 32 bits, I also have this kind of problem with 64 bits and it really does not work. My solution was remove the 64bits from GAC and install the 32 bits on GAC. I also remove any .dll file in the bin folder to my application find the assembly on GAC.
如果你的机器和操作系统是64位的没有问题,32位的版本就可以了.
There is no problem if your machine and operational system is 64bits, the 32bits version will work fine.
更新
我建议你看看Official Oracle ODP.NET, Managed Driver
,这是一个比 Oracle.DataAccess
更好的版本.这个Managed Driver
不需要机器上的Oracle Client
,只需要在connection string
的DataSource字段上提供TNS即可它适用于 32
和 64
位.
I recommend you take a look at Official Oracle ODP.NET, Managed Driver
, that is a better version than Oracle.DataAccess
. This Managed Driver
does not need the Oracle Client
on the machine, and you just need to provide the TNS on the DataSource field of the connection string
and it works fine for 32
and 64
bits.
这篇关于无法加载文件或程序集 'Oracle.DataAccess 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!