Oracle版本不匹配

时间:2018-01-23 17:26:37

标签: c# oracle

我在C#编写了一个使用Oracle版本11.0.2的代码。在使用Oracle版本10.0.2的服务器中部署代码时,它会抛出

  

错误:   “无法加载文件或程序集'Oracle.DataAccess,Version = 2.121.2.0,Culture = neutral,PublicKeyToken = 89b483f429c47342'或其中一个依赖项。尝试加载格式不正确的程序。”

在服务器上,安装oracle版本11.0.2会解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

Are you sure about Oracle version 10.2 - this is about 20 year old and out of support for long time.

I assume you don't have installed "Oracle Data Provider for .NET" (ODP.NET) at all. The standard Oracle Instant Client does not include ODP.NET by default. You can download ODP.NET from here: http://www.oracle.com/technetwork/topics/dotnet/downloads/net-downloads-160392.html

Ensure that you download the correct version. The architecture (i.e. 32-bit vs. 64-bit) must match architecture from your application and installed Oracle client. The version also have to match even the minor version number is important!

Update

The error message is Could not load file or assembly 'Oracle.DataAccess, Version=2.121.2.0 ...

So, apparently you have ODP.NET version 2.121.2.0 installed but according to your statement the Oracle client is version 10.2 (version 10.0.2 does not exist)

As I already mentioned these versions have to match. ODP.NET version 10.2.0.2 is not available anymore for download.

Thus you have to download/install Oracle Instant Client version 12.1.0.2.0

Of course, you can remove all ODP.NET and Oracle Client versions and re-install desired versions.

In general it does not matter on which version you developed your application, unless you disabled Publisher Policy. The deplyed application should load any installed version of ODP.NET automatically.