Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

c# - Oracle Instant Client and Entity Framework trouble with configuration

I'm trying to learn and figure out if it is possible to deploy an MVC, EF, ODAC 11.2.0.3 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

-Oracle.DataAccess.dll

-oci.dll

-ociw32.dll

-orannzsbb11.dll

-oraociei11.dll

-OraOps11w.dll

2) Next I updated web.config for the dbProviderFactories

   <system.data>
    <DbProviderFactories>
    <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=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
    </system.data>

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

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

4) Finally my connectionString

    <connectionStrings>
    <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" />
  </connectionStrings>

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Add a <remove … /> section in the <DbProviderFactories> element in the web config to remove any existing Oracle provider. (before the <add>)

<remove invariant ="Oracle.DataAccess.Client" />


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...