Organizational Research By

Surprising Reserch Topic

oracle instant client and entity framework trouble with configuration

oracle instant client and entity framework trouble with configuration  using -'c#,,oracle,entity-framework,odac'

I'm trying to learn and figure out if it is possible to deploy an MVC, EF, ODAC app to a server that has a previous version of ODP.NET installed. Rather than updating the sever ODP.NET (which I can't), I figured I could use the Oracle Instant Client.

Is this doable?

1) I added these dlls to my project to support Instant Client







2) Next I updated web.config for the dbProviderFactories

    <add name="Oracle Data Provider for .NET"
    description="Oracle Data Provider for .NET"
    type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess,    Version=, Culture=neutral, PublicKeyToken=89b483f429c47342" />

3)  This (afaik) is how to use the Oracle dll in the bin rathre than the GAC

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" />
    <publisherPolicy apply="no" />

4) Finally my connectionString

    <add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;
provider connection string=&quot;DATA SOURCE=XXX;PASSWORD=XXX;PERSIST SECURITY INFO=True;USER ID=XXX&quot;" providerName="System.Data.EntityClient" />

This is the error I receive
Unable to find the requested .Net Framework Data Provider.  It may not be installed.

I really appreciate any help here. I'm rather new and have a lot to learn. Thanks in advance. cheers

asked Sep 16, 2015 by sameer rathore
0 votes

Related Hot Questions

4 Answers

0 votes

Add a section in the element in the web config to remove any existing Oracle provider. (before the )

answered Sep 16, 2015 by gauravsinghal83
0 votes

It seems from your question that you need to deploy an update to your application and the new version of using only xcopy deployment permission.

Since your application is being changed, then you shouldn't need the assembly binding changes or DbProviderFactories. Just update the csproj of the class library with your edmx etc to have a reference to the new version, eg

If you get an issue with your tnsnames.ora, then you would have to do one of the following: a) Add a system environment variable TNS_ADMIN to point to the directory of the tnsnames.ora, or b) Change the connection string to something based on:


c) See if you can put a copy of the tnsnames.ora somewhere else.

answered Sep 16, 2015 by ukohale
0 votes

Here is my Xcopy solution.

I posted it over at


as well.

But I think I can post my xml without formatting issues here.

Nuget "packages.config"



(note the tag below. this may or may not be needed, but I figured it was better to clear them out since you don't know what may be in the machine.config file)


I am developing on a x64 Windows 7 machine.

I downloaded: (from

Which is the:

ODAC 11.2 Release 5 ( Download the XCopy version [Released September 11, 2012]

I unzipped this zip file.

I searched and fished out these files:

oci.dll Oracle.DataAccess.dll orannzsbb11.dll oraociei11.dll OraOps11w.dll

Note, when there were 2 files of the same name, I took the "bin\2.x\" or "odp.net20\bin" version for my 3.5 Framework need (I'm not on 4.0 yet).

I took these files, and put them in a subfolder from where my .sln file resides.


I place all the files above in the



I used "Add Reference" to add a reference to Oracle.DataAccess.dll to the "MyConsoleApp.csproj" csharp project. (This meant browsing to "..\ThirdPartyReferences\Oracle\" of course)

I used a "Post Build Event" to copy the "extra" (aka, "accessory)" files

My lines in my post build event were:

copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oci.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\orannzsbb11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oraociei11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\OraOps11w.dll $(TargetDir)*.*

Note, my post build event replaces the "Copy if Newer" from the URL instructions above.

When I ran my project........I got a few missing dll errors.

Note: In the assembly that has your calls to the EnterpriseLibrary.Data objects…you’ll get “Cannot find Microsoft.Practices.SomethingSomething namespace. Just keep adding references to these dll’s (that the above package.config will pull down) until the errors go away.

Like here is a specific one:

"Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

So (after running Nuget of course, to download all the files) I went and added a reference to:


That cleared up the issues.

And my csharp code: (note "select *" is for demo purposes only)

    using System;
    using System.Data;
    using System.Data.Common;
    using Microsoft.Practices.EnterpriseLibrary.Data;
public IDataReader EmployeesGetAll()

    IDataReader returnReader = null;


        Database db = DatabaseFactory.CreateDatabase();
        DbCommand dbc = db.GetSqlStringCommand("SELECT * FROM ( SELECT * FROM TEMPLOYEE ) WHERE ROWNUM <= 25");
        returnReader = db.ExecuteReader(dbc);
        return returnReader;




And it worked.

Thank you:

I think this makes ODP.NET an "xcopy" deployment.

I still need to test on a clean machine to be sure.

But its the end of the day..............


Additional Information:

Everything above is correct. However, I hit a caveat. I was using a "Console Application" to test my code.

When you add a new Console Application to visual studio, it DEFAULTS to x86.

As seen here:

EDIT: (Updated link)

So when I put all the configuration and code and stuff in a real project (which was set to "Any CPU" on a x64 bit machine)...everything I had done stopped working. :<

After tweaking a bit........ I found this file on I then repeated everything I did above , but searching the unzipped files of this x64 zip file.

Everything is working.

But that "x86" default thing with a Console application threw me for a loop.

answered Sep 16, 2015 by akhilesh
0 votes

I was getting the same error (data provider not found) when deploying ODP.NET via Instant Client. The only thing that I needed to do was to add the following to my exe.config file (inside the tag)

answered Sep 16, 2015 by r3tt