C # Connect Oracle with Oracle.dataaccess to pay attention to the version problem! Turn)

Source: Internet
Author: User

Ordinary people, not including all the usual in the development of the use of 32-bit PC, so the installation is also ORACLE32-bit client. However, the general server is 64-bit, and the 64-bit Oracle client is installed, and you may encounter version problems if you are deploying an application that uses oracle.dataaccess to connect to Oracle. That specifically shows in the following two areas:
There are two major version issues, one is the 32-bit version and 64-bit version of the problem, if we developed the application is 32-bit, then we must use 32-bit client, if 64-bit application of course corresponds to 64-bit client. It is important to note that using the VS development Web program in a 64-bit environment, the Web service "WebDev.WebServer.exe" that runs is 32-bit, so if you are debugging a 64-bit Oracle connector, it is best to deploy to IIS. Use IIS to connect to the Oracle database.
Another version issue is the oracle.dataaccess version number problem, my native is the 32-bit XP, installed ORACLE11GR2 client after the odp.net\bin\2 in the installation directory. The Oracle.DataAccess.dll file can be found in the X catalog and can be seen with the version number: 2.112.1.2. So I developed the program, the reference is also this version of the library.

However, under the 64-bit Oracle.DataAccess.dll is not the same, the installed version is 2.112.1.0, is windows2008x64 on the Oracle.DataAccess.dll.

Now deploys the development environment's program release to the server, throws an exception
failed to load the file or assembly "oracle.dataaccess, version=2.112.1.2, Culture=neutral, PublicKeyToken =89b483f429c47342 "or one of its dependencies.
or
Could not load file or assembly ' oracle.dataaccess, version=2.112.1.2, Culture=neutral, publickeytoken= 89b483f429c47342 ' or one of its dependencies. An attempt is made to load a program with an incorrect format and the like.
in short, the corresponding assembly cannot be found. Obviously Here the system is looking for 2.112.1.2 Version of the oracle.dataaccess, and the server only 2.112.1.0 version, so the error, the solution is to modify in Web. config, add the following after the end of the configsections node:
<runtime>
<assemblybinding xmlns= "Urn:schemas-microsoft-com:asm.v1" >
< dependentassembly>
<assemblyidentity name= "oracle.dataaccess"
publickeytoken= "89B483F429C47342"
Culture= "neutral"/>
<bindingredirect
oldversion= "2.112.1.2"
newversion= "2.112.1.0"/>
< /dependentassembly>
</assemblyBinding>
</runtime>
This allows IIS to invoke 2.112.1.0 's oracle.dataaccess. This configuration is added and will work correctly.

C # Connect Oracle with Oracle.dataaccess to pay attention to version issues!)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.