3

我正在开发 Asp.NET MVC 4 Web 应用程序。我正在尝试通过实体框架客户端连接到我的数据库“测试”。我已将 EntityFramework 引用添加到项目中,并且正在使用 MSSQL。由于未知原因,我收到以下错误: 无法找到请求的 .Net Framework 数据提供程序。它可能没有安装。

有没有人有类似的问题?

web.config 中的设置是:

<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=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>

<connectionStrings>
    <add name="TestEntities" connectionString="metadata=res://*/TestEDM.csdl|res://*/TestEDM.ssdl|res://*/TestEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MARINA-PC\MSSQL2008R2;Initial Catalog=Test;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>

InitializeSimpleMembershipAttribute类中的这一行发生错误:

WebSecurity.InitializeDatabaseConnection("TestEntities", "UserProfile", "UserId", "UserName", autoCreateTables: true);

这是一个堆栈跟踪:

at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at WebMatrix.Data.DbProviderFactoryWrapper.CreateConnection(String connectionString)
   at WebMatrix.Data.Database.<>c__DisplayClass15.<OpenConnectionStringInternal>b__14()
   at WebMatrix.Data.Database.get_Connection()
   at WebMatrix.Data.Database.EnsureConnectionOpen()
   at WebMatrix.Data.Database.<QueryInternal>d__0.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args)
   at WebMatrix.WebData.DatabaseWrapper.QuerySingle(String commandText, Object[] parameters)
   at WebMatrix.WebData.SimpleMembershipProvider.CheckTableExists(IDatabase db, String tableName)
   at WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded()
   at WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables)
   at WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
   at WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
4

1 回答 1

-1

尝试安装Microsoft SQL Server Compact 4.0

于 2012-12-16T20:01:44.910 回答