asp.net mvc Invalid value for key 'attachdbfilename'

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


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


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.