entity framework Unable to load the specified metadata resource

.net entity-framework


Possible Duplicate:
MetadataException: Unable to load the specified metadata resource

I hope someone can help with this. i have tried following other posts on here and dozens on other sites but i can get this working.

the entity framework was all working, then the next day just started giving me the error: Unable to load the specified metadata resource. on the constructor of the entities class.

I have checked the connection strings, deleted and re added everything but i still cant get this working.

my model namespace is WraithNath.co.uk.Models

the metadata artificat is embed in assembly

my connection strings are as follows:

<add name="ConnectionString" connectionString="Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;" providerName="System.Data.SqlClient" />
   <add name="Entities" connectionString="metadata=res://*/Models.WraithNath.co.uk.csdl|res://*/Models.WraithNath.co.uk.ssdl|res://*/Models.WraithNath.co.uk.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

I cant find the 3 files i need in the assembly when looking at it in Reflector.

Is there a step by step guide to sort this out? i have already tried every link on the first 3 pages of google for search results 'entity framework Unable to load the specified metadata resource'.

5/23/2017 12:02:48 PM

Accepted Answer

Craig Stuntz has written an extensive (in my opinion) blog post on troubleshooting this exact error message, I personally would start there.

The following res: (resource) references need to point to your model.

<add name="Entities" connectionString="metadata=

Make sure each one has the name of your .edmx file after the "*/", with the "edmx" changed to the extension for that res (.csdl, .ssdl, or .msl).

It also may help to specify the assembly rather than using "//*/".

Worst case, you can check everything (a bit slower but should always find the resource) by using

<add name="Entities" connectionString="metadata=
        res://*/;provider= <!-- ... -->
4/24/2012 7:44:54 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow