使用实体框架时,4元数据相关的异常 [英] Metadata related exception when using Entity Framework 4

查看:142
本文介绍了使用实体框架时,4元数据相关的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用VS 2010旗舰版。我从头开始创建一个asp.net web应用程序,增加了ADO.NET实体模型我的项目(​​EF4)。

I use VS 2010 Ultimate. I created an 'asp.net web application' from scratch, added a 'ADO.NET Entity Model' to my project (EF4).

我遇到的问题是,每当我尝试并使用EntityDataSource拉数据出我的实体模型,我不断地附近收到以下错误:

The problem I'm having is that whenever I try and use an EntityDataSource to pull data out of my entity model I am near constantly getting the following error:

在连接字符串中指定的元数据无法加载考虑重建Web项目建设可能包含元数据集以下错误(S)发生。

"The metadata specified in the connection string could not be loaded. Consider rebuilding the web project to build assemblies that may contain metadata. The following error(s) occurred:"

我重建项目,但错误时仍然存在。

I rebuilt the project but error it still there.

下面从我的web.config一块....任何想法如何解决呢?谢谢

Here a piece from my web.config .... any idea how to solve it? thanks

  <system.web>
<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

  </assemblies>

    <buildProviders>
        <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
    </buildProviders>

这是有用的在这里的文章:
<一href=\"http://thedatafarm.com/blog/data-access/embedding-edm-schema-files-in-entity-framework-beta-3/\" rel=\"nofollow\">http://thedatafarm.com/blog/data-access/embedding-edm-schema-files-in-entity-framework-beta-3/

An useful article here: http://thedatafarm.com/blog/data-access/embedding-edm-schema-files-in-entity-framework-beta-3/

推荐答案

您在您的解决方案有多个项目?

Do you have more than one project in your solution?

我猜测,你有两个,网络和EF。当您添加EF模型VS更新为EF项目配置文件。当您运行Web应用程序,它使用Web项目的配置。因此,它不能找到配置

I am guessing that you have two, the web and the EF. When you add the EF model VS updates the config file for the EF project. When you run the web app it uses the config of the web project. Therefore, it cannot find the configuration.

有就是这样的一个交代<一个href=\"http://stackoverflow.com/questions/1188681/can-someone-provide-a-quick-app-config-web-config-tutorial/1188741#1188741\">here

There is an explaination of this here

这篇关于使用实体框架时,4元数据相关的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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