Using SQL Server Databases on Shared Hosting

I am trying to deploy an ASP.NET MVC 4.0 application and I am using a generic web hosting solution. I can successfully deploy everything except my pre-existing databases, one for user accounts and one for messages.

These two databases are in the App_Data directory of my application.

Each part of the application that requires a database connection returns the following:

Invalid value for 'attachdbfilename' key

I should note that this problem does NOT occur with local testing.

My hosting provider created a SQL Server database by providing me with the server IP address, username / database and password. However, I am not sure how I can access it and then replicate the current database in my application to the database on my web host.

Basically, my question is: how do I get SQL Server databases to work on my web hosting?

+4
source share
1 answer

In this case, you should not attach your own DB files. Create a new database (for example, using SSMS or the host control panel) on the server provided by the host. Import your local data into this database and use the new server / db / uid / password in the connection string.

If your host has already provided you with a database, just use the existing database (do not create a new one), but still import local data into this database.

+5
source

Source: https://habr.com/ru/post/1502093/


All Articles