Problem connecting from .net to Oracle with EF

1

I explain a little about the problem of my scenario, in my development machine I have ODAC 12 installed and can develop normal connections against Oracle, in my production server install the same Oracle but when trying to run my application.exe launches me the following exception:

  

Message:

The specified store provider cannot be found in the configuration, or is not valid.
  

Stack

   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
   at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
   at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
   at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
   at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet'1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet'1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery'1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Where[TSource](IQueryable'1 source, Expression'1 predicate)
  

InnerExepcion

   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)

Well I do not know what it could be, since the same .exe if it works on my machine and on the server does not, discard that it is connected because another application with the connection string (the old one);

oCon = new OleDbConnection("Provider=ORAOLEDB.ORACLE;OLE DB Services=3;User Id=xxx;Password=yyy;Data Source=zzzz");

if it works normal, but the one I have with EF5 does not work for me.

    
asked by RSillerico 14.09.2016 в 19:57
source

3 answers

2

It may be that the version of the Oracle client that you installed is 64 bits but the application is running in 32 bits or vice versa.

If your application is a web application on a 64-bit server and your installed Oracle client is 32 bits, you can configure the IIS App Pool to run your app in 32 bits.

Greetings.

    
answered by 14.09.2016 / 21:18
source
0

I would recommend you from a glance to

Entity Framework, LINQ and Model-First for the Oracle Database

there creates a edmx to map the Oracle db with EF

If you can connect to Oracle from the Server Explorer then you can use this in the wizard that creates the EF model

Review section Creating an Entity Data Model using the Entity Data Model Wizard

    
answered by 14.09.2016 в 22:45
0

Thank you all for your suggestions, well the one that ultimately served me the most was Gustavo, independently compiled for x86 and x64, does x64 work, and how does it work for an ANY to work? because in project properties, in the compilation option there is a checkbox that says "preferably 32 bits", disabling that option also comes to operate the ANY. Greetings to all and again thank you very much.

    
answered by 14.09.2016 в 23:32