I recently came across an error in a .net application where the message was as follows: MetadataException: Unable to load the specified metadata resource 1 MetadataException: Unable to load the specified metadata resource It took a fair bit of digging but eventually found the underlying cause. My suspicions were that it was DB related due to the point in my application that it was failing. However, where/why I wasn’t sure. After a while I discovered the source of the problem. Entity Framework, in its wisdom, breaks down an EDMX into three constituent parts, a CSDL, SSDL and MSL. These are all strongly typed to the same namespace as your EDMX and thus the Entity Framework connection string will start something along the lines of: metadata=res://*/Your.Namespace.com.csdl|res://*/ Your.Namespace.com.ssdl|res://*/ Your.Namespace.com.msl; 1 metadata=res://*/Your.Namespace.com.csdl|res://*/ Your.Namespace.com.ssdl|res://*/ Your.Namespace.com.msl; Where Your.Namespace.com is obviously the namespace that corresponds to your EDMX. If these do not align, then Entity Framework will not know which embedded resource to load your EDMX from and thus you will. In my case, I was transforming the connection string using Powershell to add in some environment specific variables and mistakenly changed the resource names, hence this error. Therefore, if you run in to the problem of Unable to load the specified metadata resource, be sure to check this...Read More »
On my blog…
I'm a gadget loving code-junkie who loves to program, create websites and try out new stuff. Married, with two young daughters I am also a keen marathon runner and fitness enthusiast.
- Cloud Technologies (Azure & AWS)
- Mobile application development
- WordPress / Orchard CMS / Alterian ACM
- C#, Asp.net MVC & WebForms, Python
- IIS & Windows Server