at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
最近在做一个WinForm的项目. 使用vs2013开发. 数据库使用的是oracle. 在本地写了一个webservice .测试正常.发布到服务器的时候.就是提示了错误. 打开服务器上的日志.看到如下信息:
System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Kerry.FW.Service.SecurityService.GetAuthenticateUserDetail(String userName, String password, String& errorMessage) in c:\K4\Kerry.K4\Kerry.FW.Service\SecurityService.svc.cs:line
开头有点纳闷. 因为之前做过另外一个系统 .也是使用EntityFramework , 数据库使用Oracle的.可以在服务器上正常运行. 所以认为oracle 驱动没注册的应该不大可能.结果看到了这篇文章
http://blog.csdn.net/greystar/article/details/9057159
里面提到了一种情况.就是在不同位(32bit/64bit)系统上开发时,visual studio 调用的机器配置文件 machine.config是不一样的. 而我恰恰也就是原先机器使用的是32位 来进行开发. 最近刚换到了 64位.
文中重点提到了
32位的machine.config 放在的是 (不同.NET Framework 版本对应不同的文件夹)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
64位的machine.config 放在
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
出现驱动未注册的问题原因是 64位中的config 里面的system data 未配置一下内容
<system.data>
<DbProviderFactories>
<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.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
我尝试在服务器上面加上这一段. 然后重新运行. 测试结果正常.
当然另外一种方式就是将当前的项目目标生成平台改位x86.
前几天 碰到另外一种情况, 也可以能导致这个问题. 服务器上IIS应用池设置:
当应用池中的 Enable 32-Bit Application 为false 时 也可能会导致 这个问题. 重新修改为True 为 即可以正常解决
PS 关于Machine.config 的作用 http://www.cnblogs.com/dimg/archive/2005/11/12/274648.html
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)的更多相关文章
- System.Security.SecurityException The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception
[15/08/19 00:03:10] [DataManager-7292-ERROR] System.Reflection.TargetInvocationException: Exception ...
- System.Data.EntityException: The underlying provider failed on Open.
场景:IIS默认站点建立程序,使用Windows集成身份验证方式,连接SQLServer数据库也是采用集成身份验证.我报“System.Data.EntityException: The underl ...
- .Net批量插入数据到SQLServer数据库,System.Data.SqlClient.SqlBulkCopy类批量插入大数据到数据库
批量的的数据导入数据库中,尽量少的访问数据库,高性能的对数据库进行存储. 采用SqlBulkCopy来处理存储数据.SqlBulkCopy存储大批量的数据非常的高效,将内存中的数据表直接的一次性的存储 ...
- System.Data.Entity 无法引用的问题
最近刚学MVC,跟着网上的博客学习,发现代码中有这样一句: using System.Data; using System.Data.Entity; 我项目引用的时候,也引用了System.Data. ...
- 【WinForm】“System.Data.SqlClient.SqlConnection”的类型初始值设定项引发异常,无法识别的配置节 system.serviceModel
出现问题的原因: 在本机上没有出现问题,让一个同事测试的时候,在另外一台电脑上出现连接数据库失败,系统不能打开的问题 在网上搜了一下,有说是数据库连接字符串错误的,有说app.config文件配置不匹 ...
- Method 'ExecuteAsync' in type 'System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy' does not have an implementation
一.错误信息 Entity Framework 6.0数据迁移:Add-Migration XXXX 命令发生错误 System.Reflection.TargetInvocationExceptio ...
- System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
2017/8/15 20:55:21 [AgentPayQuery_205506102_1BBBB]系统异常:System.Data.Entity.Core.EntityException: The ...
- 启用SQLite的Data Provider 运行WECOMPANYSITE时遇到ERROR CREATING CONTEXT 'SPRING.ROOT': ERROR THROWN BY A DEPENDENCY OF OBJECT 'SYSTEM.DATA.SQLITE'
从网上下载的源码WeCompanySite,运行时报错 Error creating context 'spring.root': Error thrown by a dependency of ob ...
- .Net4.0以上使用System.Data.Sqlite
最近对Sqlite感兴趣,就尝试了一下用c#连接,我用的版本是vs2013,默认开发环境是.net4.5,,按照网上的教材,下载了System.Data.Sqlite,然后写了下面这个简单的测试代码, ...
随机推荐
- ural 1932 The Secret of Identifier (容斥原理)
标题效果: 计算到n字符串. 精确到只是有一个不同的字符,两个不同的字符.三个不同的字符,四对不同的字符. IDEAS: 枚举状态. dp[i] [j] ...当前串取出 i 状态下的全部字符转化成十 ...
- 【Espruino】NO.06 关键是你的仆人(继续)
http://blog.csdn.net/qwert1213131/article/details/27834551 本文属于个人理解,能力有限,纰漏在所难免.还望指正. [小鱼有点电] 这几天一直在 ...
- MPQ Storm库 源代码分析 一个
MPQ什么? MPQ维基上说的非常明确. 简而言之,它是暴雪公司用于游戏数据打包的工具.星际争霸,魔兽争霸游戏中都有使用.该工具内含游戏资源加密和压缩等功能. git下载地址:http ...
- NET MVC
NET MVC 1.为 Action 标注 Attribute 限制访问 public class HomeController : Controller { [HttpPost] public Ac ...
- git fetch, merge, pull, push需要注意的地方(转)
在git操作中,我们经常会用到fetch, merge, pull和push等命令,以下是一些我们需要注意的地方. 给大家准备了参考资料: 1. Whatʼs a Fast Forward Merge ...
- Nagios显示器MySQL一个错误:NRPE: Unable to read output具体的解决过程
前言:nagios介面.见监测mysql服务错误,如下面: Warning:NRPE: Unable to read output 1,跟nagios显示器server上check下 1.1.运行ch ...
- idea_intellij
近期要研读和调试spark2,用eclispe据说各种问题,so还是切换到 intellij 1:下载 (官网自行下载最新版本) 2: 注册码 intellij idea 2016 activati ...
- Spring中的事务传播行为
Spring在TransactionDefinition接口中定义了7种类型的事务传播行为,它们规定了事务方法是怎样传播的. PROPAGATION_REQUIRED(最经常使用!):支持当前事务,假 ...
- c++双缓冲技术,以避免闪烁绘图
当数据量非常大时,画图可能须要几秒钟甚至更长的时间,并且有时还会出现闪烁现象,为了解决这些问题.可採用双缓冲技术来画图. 双缓冲即在内存中创建一个与屏幕画图区域一致的对象,先将图形绘制到内存中的这个对 ...
- ASP.NET MVC性能优化工具 MiniProfiler
ASP.NET MVC性能优化工具 MiniProfiler 2014年04月19日 ⁄ ASP.NET ⁄ 共 1159字 ⁄ 字号 小 中 大 ⁄ 暂无评论 ⁄ 阅读 325 views 次 MV ...