我有一个使用EF6到SQL 2012和Oracle服务器的控制台应用程序。我相信应用程序是为Oracle正确配置的,但SQL部分给了我一个错误:
An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
我们正在使用Windows身份验证。我可以使用SQL Mgmt Studio连接到服务器并查看表等。我甚至确认该表正在使用dbo架构。所以我的权限应该是好的。
有人有任何建议吗?
以下是我的App.config文件的一部分:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<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>
<connectionStrings>
<clear />
<add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=oracle_user;Password=oracle_user_password;Data Source=oracle" />
<add name="Server_Connection1" connectionString="DATA SOURCE=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=servername1-scan.pdc.*****.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PSTAFF)));PASSWORD=******;PERSIST SECURITY INFO=True;USER ID=*****API" providerName="Oracle.ManagedDataAccess.Client" />
<add name="Server_Connection2" connectionString="DATA SOURCE=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=servername2-scan.pdc.*****.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PSTAFF)));PASSWORD=******;PERSIST SECURITY INFO=True;USER ID=**928275" providerName="Oracle.ManagedDataAccess.Client" />
<add name="LostTimeDbConnection" connectionString="data source=PRD2K8002\PRD2K8002;initial catalog=Losttime;integrated security=true;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>