GibboK
GibboK

Reputation: 73898

Metadata related exception when using Entity Framework 4

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

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:

"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.

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>

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

Upvotes: 1

Views: 6969

Answers (2)

John
John

Reputation: 1890

If you have just added the entity data model and not built the application yet then you will receive this error. Try building and retry accessing the data model again..

Upvotes: 1

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65361

Do you have more than one project in your solution?

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.

There is an explaination of this here

Upvotes: 1

Related Questions