Robby Cowell
Robby Cowell

Reputation: 564

Using SQL Server databases on shared hosting

I'm attempting to deploy an ASP.NET MVC 4.0 application, and I am using a shared web hosting solution. I am able to successfully deploy everything, except for my preexisting databases, one for user accounts, and one for posts.

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

Every part of the application requiring database communication returns the following:

Invalid value for key 'attachdbfilename'

I should note that this problem does NOT occur when testing locally.

My web hosting provider has created a SQL Server database, providing me with a server IP, a username/database name, and a password. However I'm unsure how I can access it, and then replicate the current database in my application in the database on my web host.

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

Upvotes: 4

Views: 1964

Answers (1)

suff trek
suff trek

Reputation: 39767

In this scenario you should not attach your own DB files. Create a new database (e.g. using SSMS or host's Control Panel) on the server provided by the host. Import your local data into that DB and use new server/db/uid/password in your connection string.

If your host already provided you the DB - just use existing DB (don't create a new one) but still import your local data into that DB.

Upvotes: 4

Related Questions