Diagnostics: x64, ODP.net and "Unable to find ... Data Provider"

by Kevin Goff 19. October 2009 21:53

Diagnostics: x64, ODP.net and "Unable to find ... Data Provider"

I came across a problem today on our x64 (extended 64 bit) servers when troubleshooting an Oracle installation. We completed the installation of the ODP.net Oracle client and setup as we normally do on our x86 machines but this time there was a problem: we weren't connecting to Oracle. I started diagnosing the problem using the typical techniques -- google the exception text. But -- no joy. There only 3 other articles that contained similar texts but none of them seemed to be pointing towards Oracle or x64. Now I knew I was in for some fun diagnosing.

Before I go to much further let me summarize the problem. First of all the error message, "Unable to find the requested .Net Framework Data Provider. It may not be installed.".

Next is the environment:

  • Running x64 machines in IIS 32bit mode.
  • We were using VS 2005, .net 2.0 runtime
  • ODP.net 10
  • Microsoft Enterprise Library - January 2006 version.

 

After trying several different typical fixes I realized I needed to start from scratch -- create a basic web app that hits oracle through ODP and see if it works. DING! The test project worked fine. So now what? Oracle works, IIS works, that pretty much leaves the Enterprise Library. After digging in to the guts of the how the Enterprise Library works I discovered that the installation process of the Oracle ODP client requires a little snip added to the machine.config. Further investigation found that Oracle did update the machine.config of the Framework64 directory but not the 32bit directory. AHA!

The solution: edit the machine.config (Located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config) and add the missing piece. The Enterprise Library needs this piece to function. (the piece that was missing for our configuration is listed in blue below)

 

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
  1. ...
  2. <system.data>
  3.   <DbProviderFactories>
  4.     <add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  5.     <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  6.     <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  7.     <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  8.     <add name="SQL Server CE Data Provider" invariant="Microsoft.SqlServerCe.Client" description=".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition" type="Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
  9.     <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  10.   </DbProviderFactories>
  11. </system.data>
  12. ...

 

Tags: , , ,

.NET Development