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/

2
  • What's your connection string? Commented Sep 9, 2010 at 9:00
  • <add name="CmsConnectionStringEntityDataModel" connectionString="metadata=~/bin/App_Code\DataAccess\CmsEntityDataModel.csdl|~/bin/App_Code\DataAccess\CmsEntityDataModel.ssdl|~/bin/App_Code\DataAccess\CmsEntityDataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=DbCmsWebsiteTest;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> Commented Sep 9, 2010 at 9:21

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.