简体   繁体   中英

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?

In this scenario you should not attach your own DB files. Create a new database (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM