无法使用Oracle.ManagedDataAccess连接oracle云数据库

时间:2017-03-29 06:10:47

标签: c# oracle oracle11g entity-framework-6

有没有人成功将oracle云数据库与Oracle.ManagedDataAccess(ODP.NET)连接? 我已经使用Oracle.DataAccess连接了oracle云,但是有些原因我需要使用Oracle.ManagedDataAccess来实现实体框架并且继承了LOGS:

" Oracle.ManagedDataAccess.Client.OracleException:ORA-12570:网络会话:意外的数据包读取错误---> OracleInternal.Network.NetworkException:ORA-12570:网络会话:意外的数据包读取错误---> OracleInternal.Network.NetworkException:ORA-12537:网络会话:文件结束"

我的配置:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client"/>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </DbProviderFactories>
  </system.data>
 <connectionStrings>        
<add name="ABC" connectionString="metadata=res://*/ABC.csdl|res://*/ABC.ssdl|res://*/ABC.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=CLOUD;PASSWORD=***;USER ID=ABC&quot;" providerName="System.Data.EntityClient"/>        
<add name="ABCEntities" connectionString="metadata=res://*/ABC.csdl|res://*/ABC.ssdl|res://*/ABC.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=CLOUD;PASSWORD=***;USER ID=ABC&quot;" providerName="System.Data.EntityClient"/>      
</connectionStrings>    
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
</configuration>

0 个答案:

没有答案