MetadataException: Unable to load the specified metadata resource

Using Entity Framework, in my context class, I had defined the constructor which pointed to a connection string:

public class EFTestContext : DbContext {
    public EFTestContext()
        : base("name=Entities") {
    }
}

When I attempted to run the application, I got this message:

 MetadataException: Unable to load the specified metadata resource

Turns out, the connection string was wrong. I had copied the constructor code over from a different project, but when I created the connection string in the web.config, I named it something other than “Entities”. Once I changed the connection string in the constructor, it was good:

: base("name=RightConnString") {
Advertisements
  1. #1 by Vasista Bhargav on January 11, 2016 - 11:20 pm

    Reblogged this on Happy DotNetting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: