Asp.net mvc 我找不到mvc4存储其数据库的位置

Asp.net mvc 我找不到mvc4存储其数据库的位置,asp.net-mvc,entity-framework,asp.net-mvc-4,entity-framework-4,Asp.net Mvc,Entity Framework,Asp.net Mvc 4,Entity Framework 4,我对MVC4非常陌生,尝试通过做一个简单的项目来学习一切。我成功地创建了一个模型和一个控件。但我不明白它的数据库存储在哪里 我可以在ASP.NET创建的网页上插入、删除、更新记录,但我找不到数据库的位置。我检查了web.config,但没有连接字符串。如何找出系统存储数据的位置 我的计算机上安装了sql server,但我检查了它,它没有存储在那里MVC4将数据库存储在应用程序数据文件夹中的mdf文件中。连接字符串可在顶级web.config中找到 <connectionStrings

我对MVC4非常陌生,尝试通过做一个简单的项目来学习一切。我成功地创建了一个模型和一个控件。但我不明白它的数据库存储在哪里

我可以在ASP.NET创建的网页上插入、删除、更新记录,但我找不到数据库的位置。我检查了web.config,但没有连接字符串。如何找出系统存储数据的位置


我的计算机上安装了sql server,但我检查了它,它没有存储在那里

MVC4将数据库存储在
应用程序数据
文件夹中的
mdf
文件中。连接字符串可在顶级
web.config
中找到

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcApplication6-20130610160316;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication6-20130610160316.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

MVC4将数据库存储在
mdf
文件中,该文件位于
App\u Data
文件夹中。连接字符串可在顶级
web.config
中找到

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcApplication6-20130610160316;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication6-20130610160316.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

Global.asax.cs:

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            // Use LocalDB for Entity Framework by default
            Database.DefaultConnectionFactory = new SqlConnectionFactory(@"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
Global.asax.cs:

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            // Use LocalDB for Entity Framework by default
            Database.DefaultConnectionFactory = new SqlConnectionFactory(@"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }

是的,有一个连接字符串。可能是您在错误的web.config文件中搜索(有多个)。您应该在web.config中有一个连接字符串。请尝试查找/App_Data/Which
web.config
?典型的MVC4项目中有几个web.config。确保签入的根Web.config.App_数据为空。我检查了主web.config和views/下的一个,但是我看不到连接字符串是的,有一个connectionString。可能是您在错误的web.config文件中搜索(有多个)。您应该在web.config中有一个连接字符串。请尝试查找/App_Data/Which
web.config
?典型的MVC4项目中有几个web.config。确保签入的根Web.config.App_数据为空。我检查了主web.config和views/下的web.config,但看不到连接字符串