1

I have Oracle Client 12 installed on my 32bit client (tnsping from client cmd):

TNS Ping Utility for 32-bit Windows: Version 12.1.0.2.0

And Oracle Client 12 installed on my 64bit Windows 2012R2 server (tnsping from server cmd):

TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0

When I compile my C#.NET application and publish it to my server I get the following exception:

Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

In the bin directory of my application on my server the Oracle.DataAcces.dll is still 2.112.3.0 and not 2.121.2.0 (which is installed on my client and on my server). Why is there the wrong Oracle.DataAccess.dll file on my server?

I have set the Enable 32-bit Application bool to True in my application pool settings.

How can I get rid of this exception?

Hack4Life
  • 563
  • 1
  • 11
  • 34
  • Life will be much easier if you use [Managed ODP.NET](https://www.nuget.org/packages/Oracle.ManagedDataAccess/) – Ulugbek Umirov Aug 31 '15 at 12:26
  • Are you sure that your reference in the project is to `Oracle.DataAccess.dll` version `2.121.2.0` – Matteo Umili Aug 31 '15 at 12:27
  • No it isn't. Where can I change this @codroipo? – Hack4Life Aug 31 '15 at 12:28
  • I have removed the old reference and added the new one. Uploaded the porject and on my server the version is now correct but I still get the same error @codroipo ... – Hack4Life Aug 31 '15 at 12:37
  • Remove attribute `processorArchitecture=...` from reference in your "*.csproj" file, See details here: http://stackoverflow.com/questions/659341/the-provider-is-not-compatible-with-the-version-of-oracle-client#25412992 – Wernfried Domscheit Aug 31 '15 at 13:24
  • I have it updated now and I get the following exception now @Wernfried: `Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)` – Hack4Life Aug 31 '15 at 13:31
  • Your application tries to load version **4**.121.2.0. If you like to load version 2.x you must set your compiler target to something lower than `.NET Framework 4`, e.g. `.NET Framework 3.5` – Wernfried Domscheit Aug 31 '15 at 14:28
  • I have reuploaded the application and get an exception with incorrect format @Wernfried: `Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.` – Hack4Life Aug 31 '15 at 14:29
  • Version of TNS Ping utility is not necessarily the same as version of `Oracle.DataAcces.dll`. Check it carefully with "Properties" in File Explorer. – Wernfried Domscheit Aug 31 '15 at 14:33
  • They both have the version number `4.121.2.0` (on my client and on my server in the bin directory) – Hack4Life Aug 31 '15 at 14:48
  • @Hack4Life What is your project target? x86, x64 or AnyCPU? What is the target platform of the `Oracle.DataAcces.dll` you are referencing? (http://stackoverflow.com/questions/270531/how-to-determine-if-a-net-assembly-was-built-for-x86-or-x64) – Matteo Umili Aug 31 '15 at 15:07
  • AnyCPU. My client is running on Windows 7 professional 32bit and on my server is Windows Server 2012R2 64bit. I have enabled the 32-bit Applications in my Applicationpool settings @codroipo – Hack4Life Aug 31 '15 at 15:09
  • @Hack4Life An AnyCPU application in 64-bit environment will be run as x64, doesn't matter if you `enabled 32-bit application in appPool`. If you want it to run as 32 bit application you have to set the target platform as x86 and recompile – Matteo Umili Aug 31 '15 at 15:12
  • Ok thanks, i will try it later that week when I'm back at the office @codroipo – Hack4Life Aug 31 '15 at 15:13

0 Answers0