From scratch, I made a new solution with two projects: one was MVC 3 and the other a supporting EF 4.2 project. The whole thing builds successfully. From the MVC project I
Just copy the connection string information from your EF model project App.Config into your and watch that you do not repeat any sections (entityFramework section for example)
I added this to my Global.Asax file so that a) the database was started immediately and b) the table definition was added. allowing the Controller to find the table definition:
System.Data.Entity.Database.SetInitializer<ProjectName.DAL.DBConnectContextName>(new CreateDatabaseIfNotExists<ProjectName.DAL.DBConnectContextName>());
First of all you should check your connection string must be in your Web.Config file in the ROOT! of your project after that check if there is another connection string or not if there is another connection string replace it with your connection string.... This solved my problem which was same as your's....
Try this:
<add name="Monsters2Entities"
connectionString="
metadata=res://*/Monsters.csdl|
res://*/Monsters.ssdl|
res://*/Monsters.msl;
provider=System.Data.SqlClient;
provider connection string='
data source=.;
initial catalog=Monsters2;
integrated security=True;
pooling=False;
multipleactiveresultsets=True;
App=EntityFramework
'"
providerName="System.Data.EntityClient"
/>
I have replaced "
with '
first need to install package entity framework
go to tool> Libray package manager> pakage manager console > :install entity framework