Failed to load the specified metadata resource error in Entity Framework 4

I use ASP.NET Webforms and Entity Framework 4, and this is my screenshot of the .edmx file, because I don't know what code to send here:

enter image description here

And this is my connection string in my web.config file:

 <add name="tebimir_db_tebimEntities" connectionString="metadata=res://*/DataAccessLayer.tebimir_db_tebim.csdl|res://*/DataAccessLayer.tebimir_db_tebim.ssdl|res://*/DataAccessLayer.tebimir_db_tebim.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tebim.ir,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 

My .edmx file is inside a folder called DataAccessLayer . When I use the Entity Framework, it works fine and there is no problem, but ONLY when I create an entityDataSource control and want to assign it .edmx , I get an error that metadata could not be found, otherwise it works correctly.

I mean, I can access data using the Entity Framework. I checked all the questions related to stack overflow, but could not find the answer. Please, help.

enter image description here

This is additional information if it can help you:

enter image description here enter image description here

+7
c # entity-framework
source share
2 answers

First of all, you will not encounter this problem on VS 2012. This is a specific Visual Studio 2013 problem, and I was able to reproduce it. Here is the solution:

  • Double-click the edmx file in Solution Explorer to open it in the edmx designer. Right-click on an empty surface. Click "Model browser" in the context menu.
  • In the Model Browser window, select the conceptual node model. It will be parallel and just below the node diagrams. By default, the name of this node is the name of the database, combined with the string "Model". For example, if my database name is Employee, then this node is considered as EmployeeModel. Right-click the conceptual node model. Click "Properties" in the context menu.
  • Change the value of the "Meta Artifact Processing" property from "Paste to output assembly" to "Copy to output directory"

enter image description here

Now you can point your entityDataSource control to this edmx through the error-free data source configuration wizard. See the Note in the “.edmx File Properties” section of the link below:

https://msdn.microsoft.com/en-us/library/cc982042%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396

+4
source share

It seems that you misconfigured the MetadataArtifactProcessing property.

Try setting MetadataArtifactProcessing = EntityDeploy

+3
source share

All Articles