"无法找到所需的.NET Framework数据提供程序。它可能没有安装&QUOT。 [英] "Unable to find the requested .Net Framework Data Provider. It may not be installed."

查看:1432
本文介绍了"无法找到所需的.NET Framework数据提供程序。它可能没有安装&QUOT。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道已经有很多关于此错误的其他帖子,但没有已经能够摆脱任何灯光或对我的问题有所帮助。我使用的是直上连接SqlEx preSS,所以没有特殊的Oracle和MySQL数据库或任何东西。看起来这应该只适合像手套。

I know that there have been a lot of other postings on this error but none have been able to shed any light or help on my issue. I am using a straight up connection to SqlExpress, so no special Oracle or MySQL databases or anything. It seems like this should just fit like a glove.

所以,情况是这样的,我已经创建了一个解决方案,包括项目屈指可数;资料库,资料(EF5.0),公用事业,测试项目和一个MVC Web应用程序。我们的目标是通过使用EF5并从测试项目和MVC应用程序的一些存储库库项目库通过数据类来简单地访问底层SQL防爆preSS数据库。

So the scenario is this, I have created a solution, comprised of a handful of projects; Repositories, Data (EF5.0), Utilities, a Test project and an MVC Web Application. The goal is to simply access an underlying SQL Express database via the Data classes via repositories in the Repositories project using EF5 and some repositories from the test project and the MVC Application.

测试项目工程,并能没有问题,访问和更新数据库。

The test project works and is able to access and update the database with no issue.

MVC的Web项目,但是,抛无法找到请求的.NET Framework数据提供程序。它可能没有安装。错误,我不明白,因为它使用相同的连接字符串作为测试项目。

The MVC Web Project, however, is throwing the "Unable to find the requested .Net Framework Data Provider. It may not be installed." error, which I do not understand as it uses the same connection string as the Test Project.

[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1426271
   WebMatrix.Data.DbProviderFactoryWrapper.CreateConnection(String connectionString) +64
   WebMatrix.Data.<>c__DisplayClass15.<OpenConnectionStringInternal>b__14() +16
   WebMatrix.Data.Database.get_Connection() +19
   WebMatrix.Data.Database.EnsureConnectionOpen() +12
   WebMatrix.Data.Database.QueryValue(String commandText, Object[] args) +63
   WebMatrix.WebData.DatabaseWrapper.QueryValue(String commandText, Object[] parameters) +14
   WebMatrix.WebData.SimpleMembershipProvider.GetUserId(IDatabase db, String userTableName, String userNameColumn, String userIdColumn, String userName) +232
   WebMatrix.WebData.SimpleMembershipProvider.ValidateUserTable() +85

我有...


  1. 注册在web.config中的System.Data.SqlClient的。

  2. 已验证System.Data这的注册版(2.0.0.0)每的这篇文章

  3. 确信,有在连接字符串中没有错别字。

下面是我在web.config中...

Here's what I have in the web.config ...

  <connectionStrings>
    <add name="DBCatalogContext" 
         connectionString="metadata=res://*/DBCatalog.csdl|
                                    res://*/DBCatalog.ssdl|
                                    res://*/DBCatalog.msl;
                                    provider=System.Data.SqlClient;
                                    provider connection string=&quot;data source=.\SQLEXPRESS;
                                                                     initial catalog=DBCatalog;
                                                                     integrated security=True;
                                                                     multipleactiveresultsets=True;
                                                                     App=EntityFramework&quot;" 
         providerName="System.Data.EntityClient" />
  </connectionStrings>

  <system.data>
    <DbProviderFactories>
      <add name="SqlClient Data Provider" 
           invariant="System.Data.SqlClient" 
           description=".Net Framework Data Provider for SqlServer" 
           type="System.Data.SqlClient.SqlClientFactory, 
                 System.Data, 
                 Version=2.0.0.0, 
                 Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    </DbProviderFactories>
  </system.data>

我看到,没有任何意义,我唯一的一点是,当我选择参考文件夹下的System.Data这参考,并期待在性能它说,它的4.0.0.0版本,但是当我的配置网站我仍然得到错误的DbProviderFactories部分中更改版本。此外,我甚至不看参考这个库中的测试项目,该项目的工作。

The only thing I see that doesn't make sense to me is, when I select the "System.Data" reference under the "References" folder and look at the properties it says that it's version 4.0.0.0, but when I change the version in the "DbProviderFactories" section of the config site I still get the error. Also I don't even see the reference to this library in the Test project which works.

我相信,这是一个疏忽或者说我缺少一些配置设置,但我不知道还有什么地方来看待这点,所以任何帮助,将AP preciated。

I am confident that this is an oversight or that I am missing some config setting, but I do not know where else to look at this point, so any help would be appreciated.

谢谢,

推荐答案

我显然留下了一些最终的相关信息,当我最初发布。这包括一个事实,即正在由会员服务抛出的错误;特别是... ... SimpleMembershipInitializer原来这个类指定的连接字符串......DefaultConnection在web.config中定义的,要初始化数据库连接时使用。

I had apparently left out some ultimately pertinent information when I originally posted. This included the fact that the error was being thrown by the membership services; specifically the ... SimpleMembershipInitializer ... originally this class specified the connection string ... "DefaultConnection" defined in the web.config, to be used when initializing the database connection.

WebSecurity.InitializeDatabaseConnection("DefaultConnection", "Users", "UserId", "UserName", autoCreateTables: false);

我已经改变了它使用我已经加入到web.config中的DBCatalogContext连接字符串,以为我会用这个单一连接字符串代替。这个问题当然是,我添加了新的连接字符串是其中的会员服务不承认导致数据提供程序错误实体框架的连接字符串。

I had changed it to use the "DBCatalogContext" connection string I had added to the web.config, thinking that I would use this single connection string instead. The problem, of course, is that the new connection string that I added was an Entity Framework connection string which the membership services did not recognize resulting in the data provider error.

我简单地加回到原来的,正规的连接字符串,除了实体框架的连接字符串,现在一切正常。那么有关的一切这个问题...

I simply added back the original, regular connection string, in addition to the Entity Framework connection string and now everything works. Well everything relating to this issue ...

<connectionStrings>
    <add name="DBCatalogContext" 
         connectionString="metadata=res://*/DBCatalog.csdl|
                                    res://*/DBCatalog.ssdl|
                                    res://*/DBCatalog.msl;
                                    provider=System.Data.SqlClient;
                                    provider connection string=&quot;data source=.\SQLEXPRESS;
                                                                     initial catalog=DBCatalog;
                                                                     integrated security=True;
                                                                     multipleactiveresultsets=True;
                                                                     App=EntityFramework&quot;" 
         providerName="System.Data.EntityClient" />


    <add name="DefaultConnection" 
         providerName="System.Data.SqlClient" 
         connectionString="data source=.\SQLEXPRESS;initial catalog=DBCatalog;integrated security=True;multipleactiveresultsets=True;App=EntityFramework" />

  </connectionStrings>

我希望别人能有所帮助。

I hope that someone else can find this helpful.

这篇关于&QUOT;无法找到所需的.NET Framework数据提供程序。它可能没有安装&QUOT。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆