I am currently reading Manning\'s \"ASP.NET MVC 4 in Action\" book and trying to get the first example to work.
Within my test application, I built a simple Model a
I think the problems here is string in web.config is not correct According to your set up sql, the string will work if you set something similar like this
<add name="MovieDBContext"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Movies;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"
/>
Data Source=.\SQLEXPRESS; --> sometime, it will be Data Source=.; after that, you need config right to access FOlder App_Data If u test on Window 7, right click folder. property Security tab -> add user network Service with full right
Facing the same issue, I have looked over my connection string and found that "UNC-style" paths e.g. \\MyServer\MyDBServer
are not allowed, one has to use the MyServer\MyDBServer
syntax for a remote host or the .\MyDBServer
syntax for locally hosted DB Servers.
I tried finding a solution for this particular error without success.
Fixed it in the end by updating the .Net Framework 4 to 4.0.2. Patch and details can be found Here is the link
Hope it helps