How to connect to remote database from local Visual Stuio

Programming, error messages and sample code
When first publish application to our server,you may get a database connection error:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
If you are connecting to local database or 3rd party database server,please follow below steps to fix this issue.
 
  1. Make a full backup of local database,upload this backup to db folder via FTP.

  2. Login to your control panel-->create a new database-->actions-->Restore with backup file.

  3. Update connection string in Visual studio,you need to comment local database connection string first,then add new string to remote connect to server database(you can get database string sample at your control panel-->database).

  4. Debug application via visual studio,try to connect to database to see if you will get connection error.

  5. If you confirm you can connect to server's database without any problems,please republish application to server.
Note:if you want to connect to 3rd party database server,please consider .NET Premium hosting plan or higher,then add the remote database server's IP address and port to whitelist.