无法检索元数据 - MVC应用程序 [英] Unable to retrieve metadata - MVC application
问题描述
我是在以下,其中解决方案是通过更改providerName提供的。但在我的情况下,它已经 System.Data.SqlClient 。以下是我的connectionStrings:
< connectionStrings>
< add name =DefaultConnectionconnectionString =Data Source = .\SQLEXPRESS; Initial Catalog = aspnet-MvcApplication-20130708120940; Integrated Security = SSPIproviderName =System.Data.SqlClient/>
< add name =MovieDBContextconnectionString =Data Source =(LocalDB)\v11.0; AttachDbFilename = | DataDirectory | \Movies.mdf; Integrated Security = TrueproviderName =System.Data。 SqlClient/>
< / connectionStrings>
错误讯息说< $ c> AttachDbFilename ,它是 MovieDbContext
连接字符串的一部分。
string目前显示此 AttachDbFilename = | DataDirectory | \Movies.mdf
,所以它看起来现在mdf文件现在从 App_Data
文件夹。
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>
The error message is saying invalid value for AttachDbFilename
which is part of your MovieDbContext
connection string.
The connection string currently shows this AttachDbFilename=|DataDirectory|\Movies.mdf
so it appears the mdf file is now missing from the App_Data
folder.
这篇关于无法检索元数据 - MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!