So you have created an ASP.NET website using the template in Visual Studio. Now you want to deploy your site and instead of using an .mdf file, you want to use a database on SQL Server.
Here are the things you need to achieve in order to do that.
1- Create an empty database on your SQL Server
2- Register your database using ASP.NET SQL Server Registration Tool (Aspnet_regsql.exe)
(check my post on how to do it.)
3- Update the web.config of your website. (update Connection String)
Sample default Connection String:
connectionString=”data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true”
How it should be:
connectionString=”Data Source=DBSERVERNAME;Initial Catalog=YOURNEWDBNAME;Integrated Security=True”
4- Add NT AUTHORITYNetwork Service to the users of your DB (YOURNEWDBNAME) as “db owner” (check my post on how to do it)
Now your website should be working on your new database.
Hope this helps someone.