Invalid value for key attachdbfilename

Jan 20, 2011 at 9:21 AM

Hi
I am stuck on part 4 of the tutorial when running the page, I am getting a problem with the line var genres = storeDb.Genres.ToList(); and when the page runs and I browse to /store URL I get the error back in visual studio of "Invalid value for key 'attachdbfilename'

Any ideas on what I am doing wrong - I followed the tutorial word for word?

This is from my webconfig? I have installed SQL Express on my local c: drive

   <connectionStrings>
    <add name="MusicStoreEntities" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI; AttachDBFilename=|Data Directory|\MvcMusicStore.mdf; User Instance=true" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

I also attached the .mdf file from the download from codeplex into the APP_DATA folder in visual studio by right clicking and ADD> New item etc as per the tutorial

 Any ideas on what I am doing wrong?  I am a newbie to .NET and MVC

Coordinator
Jan 27, 2011 at 1:13 AM

I found some information on that error with some things to check here: http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/1d67d33b-0728-4951-8f11-4036be883d55/

One recommendation in particular stood out to me:

If you receive this error while using .\SQLEXPRESS as host name, it may make sense to inspect the SQL Server Configuration to see whether the .\SQLEXPRESS name is not mapped as an alias to another server name/address, as this will cause the same error message.