关键'attachdbfilename'asp.net的MVC值无效 [英] asp.net mvc Invalid value for key 'attachdbfilename'
问题描述
我目前正在读曼宁的ASP.NET MVC 4在行动一书,并试图获得的第一个例子工作。
I am currently reading Manning's "ASP.NET MVC 4 in Action" book and trying to get the first example to work.
在我的测试应用程序,我建立了一个简单的模型,并创造了一些看法。然后我输入的SQL Server Compact使用的NuGet。
Within my test application, I built a simple Model and created some Views. I then imported "SQL Server Compact" using NuGet.
当我终于尝试运行我得到以下错误的应用程序:
When I finally try to run the application I get the following error:
Invalid value for key 'attachdbfilename'
这发生在与数据库(选择或其他CRUD操作)我正在运行的每一次互动。有任何想法吗?
This occurs on every interaction with the Database (SELECT or other CRUD operations) I am running. Any ideas?
推荐答案
不过,我有点晚来回应这个问题,但我面临着同样的问题,我通过修改连接字符串,如下面
Though, I am bit late to respond to this question but I was facing the same issue and I resolved it by modifying the connection string like below
<add name="MovieDBContext"
connectionString="Data Source=.;Initial Catalog=Movies;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
希望这将是为别人也是有帮助的。
Hope this would be helpful for others too.
这篇关于关键'attachdbfilename'asp.net的MVC值无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!