views:

92

answers:

1

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/

A: 

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

Shiraz Bhaiji
Hi, I was able to solve the problem changing "Metadata Artifact Processing" from Embed to "Copy to Outpu Directory. Now seems working. I am pretty new in ASP.NET and I do not know exactly how this command work. Thanks
GIbboK
I see from your other comment that the connection string is pointing to the files outside the DLL. The connection string and the output mode must match. We always use embedded, fewer files to deploy.
Shiraz Bhaiji
Also check this link http://stackoverflow.com/questions/1074337/metadataexception-when-using-entity-framework-entity-connection
Shiraz Bhaiji