Where is the default database created for C# MVC ASP.NET application?

前端 未结 5 2148
鱼传尺愫
鱼传尺愫 2021-02-07 13:06

I\'ve got new MVC ASP.NET app on bootstrap with login/register script and it works ok, but I don\'t know where is default database for this app. My App_Data folder is empty. Can

相关标签:
5条回答
  • 2021-02-07 13:30

    Normally we connect our model or DAL to a databases like Sql Server or MySQL etc. But as per you question i understood that just you are using a visual studio built-in application. visual studio stores that data in localDB

    0 讨论(0)
  • 2021-02-07 13:31

    Default connection string will be

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

    So it will be created in your app data. MDF file will be created. Though you can change the connection

    0 讨论(0)
  • 2021-02-07 13:32

    Here is something in case you can't see the DefaultConnection and AspNet tables in Server Explorer: You need to register a user at least once to get these tables created or at least to show.

    0 讨论(0)
  • 2021-02-07 13:35

    In your Web.config ,look for 'Connectionstring'

     <connectionstrings>
            <add name="ConnectionstringName" connectionstring="Data Source=DatasourceName;Initial Catalog=This_isDefault_db;Persist Security Info=True;User ID=ID;Password=pwd" providername="System.Data.SqlClient" />
        </connectionstrings>
    

    The catalog attribute tells you which is your db.

    0 讨论(0)
  • 2021-02-07 13:38

    enter image description here

    This will stored under Sql express that came along with visual studio 12,13 &15.

    You can connect it using server explore under View - > server Explorer

    0 讨论(0)
提交回复
热议问题