加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-3 – 无法加载文件或程序集“System.Data.Entity”

发布时间:2020-12-16 00:30:21 所属栏目:asp.Net 来源:网络整理
导读:我正在一个解决方案(一个笑话网站)工作。解决方案有2个项目: 模型(C#类库) MVC 3空应用程序 我试图让我的观点列出数据库中的笑话,但是我收到以下错误: Could not load file or assembly ‘System.Data.Entity,Version=4.0.0.0, Culture=neutral,PublicKey
我正在一个解决方案(一个笑话网站)工作。解决方案有2个项目:

>模型(C#类库)
> MVC 3空应用程序

我试图让我的观点列出数据库中的笑话,但是我收到以下错误:

Could not load file or assembly ‘System.Data.Entity,Version=4.0.0.0,
Culture=neutral,PublicKeyToken=31bf3856ad364e35’ or one of its
dependencies. The system cannot find the file specified

从Error消息可以看出,我已经将System.Data.Entity添加到MVC 3应用程序的web.config中。

无论我做什么,我似乎无法修复错误!我已经为Entity类,HomeController和Index.cshtml添加了使用语句。

解决方法

要使用ASP.NET MVC 3使用外部实体框架模型(例如嵌入到DLL中),您必须:

>添加以下对MVC项目的引用:System.Data.Entity(版本4.0.0.0,Runtime v4.0.30319)
>在web.config中添加以下行

< compilation debug="true" targetFramework="4.0">

  <assemblies>
    <add assembly="System.Data.Entity,Culture=neutral,PublicKeyToken=b77a5c561934e089" />
  </assemblies>
</compilation>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读