Problem after loading into azure with EF Failed to load the specified metadata resource error

I work with ASP.net MVC5 Application and with the first approach of the EF 5 Model. But it also uses the poco classes that are in another C # project called "Entity".

I have a layered architecture where the Edmx file is in the DAL layer, and the BAL has a link to it, and the BAL and Entity Project are referenced in the main web project.

Everything works well, but after setting up the database and the project on Azure , when my site tries to connect to the database, it throws below the error "MetadataException: Unable to load the specified metadata resource"

I was stuck in a problem for two days and tried all possible solutions mentioned on stackoverflow or any other blogs. But believe me, the guys do not work, because I give the full build path, dll in meta deta. use of metadata = res: // * /; also didn't work for me. I feel a lot of stress here.

Please help me. Screenshots and connection string in web.config are attached.

<add name="questmysqlEntities" connectionString="metadata=res://QuestCloud/QuestCloudDAL/QuestCloud.csdl|res://QuestCloud/QuestCloudDAL/QuestCloud.ssdl|res://QuestCloud/QuestCloudDAL/QuestCloud.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source******servername****;Initial Catalog=questdb;Persist Security Info=True;user id=****username****;password=****password****;MultipleActiveResultSets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 

My Edmx file is in the DAL (Database Layer) project and the POCO Template in the Entity project,

enter image description here

BAL (Business Layer) has a link as Project

enter image description here

My web project has a link to the BAL project (business layer) and Entity

enter image description here

+4
source share
1 answer

I got a solution to the above problem. I just added the " QuestCloudDAL.dll " link to my main QuestCloud project. And also put a link to this assembly in my main web.config as,

  <add name="questmysqlEntities" connectionString="metadata=res://QuestCloudDAL/QuestCloud.csdl|res://QuestCloudDAL/QuestCloud.ssdl|res://QuestCloudDAL/QuestCloud.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source******servername****;Initial Catalog=questdb;Persist Security Info=True;user id=****username****;password=****password****;MultipleActiveResultSets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 

instead of "*", I set the QuestCloudDAL namespace for the metadata resources in the we.config connection string. And it works as expected.

0
source

All Articles