I was following this to create a simple MVC application. After creating the model, when I tried to add controller, I got the following error :
Unable to retrieve metadata for "MvcApplication.Models.Movie". Invalid value for key "attachdbfilename".
Can someone tell why I am getting this error.
Update : I saw this wherein solution is provided by changing the providerName. But in my case it is already System.Data.SqlClient. Following are my connectionStrings :
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.SQLEXPRESS;Initial Catalog=aspnet-MvcApplication-20130708120940;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
<add name="MovieDBContext" connectionString="Data Source=(LocalDB)v11.0;AttachDbFilename=|DataDirectory|Movies.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…