注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

天涯倦客的博客

祝福你朋友永远快乐!

 
 
 

日志

 
 

MvcMusicStore :Error: Unable to find the requested .Net Framework Data Provider  

2011-10-16 19:23:10|  分类: MVC |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Error: Unable to find the requested .Net Framework Data Provider. It may not be installed

Having some issues deploying applications with ASP.NET MVC 3 and Entity Framework Code First using Microsoft SQL Server Compact Edition, even after I have installed on the server Microsoft SQL Server Compact Edition and Express.

Deploying ASP.NET MVC 3 with Entity Framework Code First you may have a few issues when deploying into a computer with only .NET 4 installed, I have to install MVC 3 dlls and Entity Framework CF to use the Compact Database.

This is the error you may get if you do not copy all the dlls.

[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +160
   System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(String nameOrConnectionString) +168
   System.Data.Entity.Internal.LazyInternalConnection.Initialize() +158
   System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +17
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62
   System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TRes

 

Steps to fix the problem

You need System.Data.SqlServerCe.dll make sure in the properties you enable the local copy.

Add the provider to your web.config

<system.data> <DbProviderFactories> <remove invariant="System.Data.SqlServerCe.4.0" /> <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>

 

Then you going to get this error, yet not to worry.

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

Now you should reference the dll System.Data.SqlServerCe.Entity.dll located in a private directory

C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private

Make sure you set the flag in the properties to copy it local, so gets deploy with all the dlls to the server that may not have that dll.

 

You may also get the error: Could not load file or assembly 'System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Still not having any success is running ASP.NET MVC 3 with Microsoft SQL Server Compact Edition 

Cheers

Al

Published Friday, May 27, 2011 7:13 PM by albertpascual
Filed under: ASP.NET, ASP.NET MVC

 http://weblogs.asp.net/albertpascual/default.aspx

  评论这张
 
阅读(2163)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017