I spent nearly two days trying to resolve this issue. My new desktop at work is running Windows 7 (64-bit) and some of our applications are still using System.Data.OracleClient as an adapter instead of Oracle’s own ODP.NET. Microsoft’s driver interops with Oracle’s own client installed on the developer machine (oci.dll). We need to continue running our web applications under 32-bit IIS, which is where the problem lies.
FYI… According to Microsoft:
The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.
Back to the comment about IIS. Apparently, IIS 7 in Windows 7 is 64-bit only. Yes, you can set an application pool to 32-bit. That would be perfectly fine, except that Oracle’s client native methods don’t like running through WoW64. So, you have to install both the 64-bit client and the 32-bit client. After all, 32-bit adapter code can’t call a 64-bit client. If you fire up procmon, though, you’ll see that calling the 32-bit Oracle client still queries 64-bit settings (and fails if they don’t exist). WoW64!, indeed.
Continue reading to see my resolution…
Note: this forces Oracle 220.127.116.11 to use 32-bit only in a 64-bit environment.
The first mistake I made was to install the Oracle 10g client on Windows 7. This WILL NOT work. If you install it, you will have to perform some cleanup afterward.
- Go to Oracle’s site and download the 11g 32-bit and 64-bit clients.
- Go here and follow the “Dummy registry entry” steps.
- Open regedit and verify that HKLM\SOFTWARE\Wow6432Node\ORACLE\inst_loc points to the proper location (probably C:\oracle\Inventory)
- Point the registry entry at HKLM\SOFTWARE\Wow6432Node\ORACLE\VOBHOME2.0 to the 32-bit Oracle folder
- Create an ORACLE_HOME environment variable and point it to the 32-bit folder.
Now you should be all set after a restart.
If you tried installing the Oracle 10g client, you’ll have to perform some cleanup. First, make sure Oracle 10g is completely uninstalled, dereferenced from your PATH variable, and the directory is removed. Then, find the assemblies referenced in the GAC:
gacutil /l | find /i "Oracle" > c:\[some directory]\oracle.txt
Find the lines referring to Oracle.DataAccess version 10.2 and remove them from the GAC. As an example (this won’t work unless you have the same version installed):
gacutil /u "Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342"
When I did this, I had three assemblies to remove:
Again, you’ll probably need to restart (hey, it’s Windows).