You are missing AttachDBFilename=|DataDirectory|
DataDirectory| (enclosed in pipe symbols) is a substitution string
that indicates the path to the database. It eliminates the need to
hard-code the full path which leads to several problems as the full
path to the database could be serialized in different places.
DataDirectory also makes it easy to share a project and also to deploy
an application.
quote from MSDN
Use the AttachDBFilename connection string keyword to add a database
to your LocalDB instance. When using AttachDBFilename, if you do not
specify the name of the database with the Database connection string
keyword, the database will be removed from the LocalDB instance when
the application closes.
try to change you connection string like something like this:
<add name="myConnectionString"
providerName="System.Data.SqlClient"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\CapacityDatabase.mdf;InitialCatalog=CapacityDatabase;Integrated Security=True;MultipleActiveResultSets=True" />
EDIT
|DataDirectory| is a placeholder, that in the case of the ASP.Net MVC template refers to the directory App_Data. This way it is possible to specify a relative path for your db file.
You can define the value for |DataDictionary| like this:
AppDomain.CurrentDomain.SetData("DataDirectory", @"C:\XYZ\App_Data\");
but is not possible to use a relative path that point to a location higher in the directory structure.