This is part of a multi page blog post where I talk about what I do after I setup my Visual Studio ASP.NET MVC (non-Core) project.
This is part of a multi page blog post where I talk about what I do after I setup my Visual Studio ASP.NET MVC (non-Core) project.
To go back to the previous posts or start at the beginning, please go to this link: How I Setup my Visual Studio Website Project Asp.Net MVC (non-Core)
At this point I don't like to use the LocalDb for my database but SKIP THIS STEP if you're OK using the LocalDb provided.
<connectionStrings> <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-vsStarterKit.mdf;Initial Catalog=aspnet-vsStarterKit-20170302095959;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings>
<connectionStrings> <add name="DefaultConnection" connectionString="Data Source=(local);Initial Catalog=YOUR_DB;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings>
At the same time, I also change my Web.Release.config connection string to point to my live database when I publish.
<?xml version="1.0"?> <configuration xmlns:xdt="https://schemas.microsoft.com/XML-Document-Transform"> <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=(local),1533;Initial Catalog=YOUR_DB_NAME;Persist Security Info=True;User ID=YOUR_LOGIN_ID;Password=YOUR_PWD;MultipleActiveResultSets=True" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> </connectionStrings> <system.web> <compilation xdt:Transform="RemoveAttributes(debug)" /> </system.web> </configuration>