Tuesday, May 15, 2012

Using ODAC with EF4 via WCF

Oracle Data Access Components (ODAC) 11.2 Release 4 (11.2.0.3.0) with Oracle Developer Tools for Visual Studio includes support for Entity Framework and LINQ. Implementation is simple, however when I called the query from a WCF service I got the error:

System.ArgumentException was unhandled by user code
  Message=The specified store provider cannot be found in the configuration, or is not valid.
  Source=System.Data.Entity
  StackTrace:
       at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
       at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
       at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
       ...
  InnerException: System.ArgumentException
       Message=Unable to find the requested .Net Framework Data Provider.  It may not be installed.

A bit of research discovered that 32-Bit Applications are disabled by default in the IIS Application Pool. As soon as I changed Enable 32-Bit Applications to True everything worked fine.


6 comments:

  1. I wouldn't be surprised if you run into more issues. I had to use ODAC on my last assignment and it was kind of a pain to deal with.

    ReplyDelete
  2. Hi:
    Did you run into any issues when debugging through VS?

    I'm using VS 2010, Oracle 10g, ODAC (Oracle.DataAcess.dll). My solution includes a WPF client and a WCF service (which is supposed to talk to ORACLE). I run both the client app and WCF in VS 2010 (so service is run in WCFSvsHost).

    When I attempt to create a new Oracle connection, I get the following:

    The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception." InnerException {"The provider is not compatible with the version of Oracle client"} System.Exception {Oracle.DataAccess.Client.OracleException}

    Any ideas on how to resolve this?

    Thanks,
    JohnB

    ReplyDelete
    Replies
    1. Where is your WCF service being hosted? This fix is applied to an IIS app pool which must be used by the site/service to be effective.

      Delete
  3. you rock. New machine and I totally forgot about that. Thank you!!

    ReplyDelete