Last post Jan 16, 2018 10:16 PM by wer246
Jan 16, 2018 01:50 PM|wer246|LINK
I am attempting to build and remotely host the standard VS2017 ASP.Net web forms template as a starter to developing it further for my own application.
I have built the application and deployed it on a hosted server where it works until it accesses the MSSQLLocalDB database using a connection string like "Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Test-123.mdf". This produces
the error "The server was not found or was not accessible."
My hosted server's help desk tells me that is because Windows Authentication is not allowed on the shared server and I do not have permissions to attach a database. They have suggested that I create a database and user, backup the database on my development
computer and restore it to the hosted database.
I produced the backup with VS2017 and a script like "BACKUP DATABASE [aspnet-Test-123] TO DISK = N'C:\Users\xx\source\repos\Test\Test\App_Data\aspnet-Test-123.bak' WITH NOFORMAT, INIT, NAME = N'Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
I attempted to restore the backup on the hosted service which generated the error "The database was backed up on a server running version 13.00.4001. That version is incompatible with this server, which is running version 11.00.3128."
How do I use VS2017 to backup the database to an older version of SQL server? Or, is there another way I can get my VS2017 template project to access its server hosted database?
Jan 16, 2018 03:34 PM|ryanbesko|LINK
You can't backup to an older version of SQL Server. Create an empty database on your hosted server. On your local server, right-click the database, point to Tasks, and click Generate Scripts... On the Set Scripting Options page of the wizard that open click
the Advanced button to choose options such as objects only or data and objects, etc. Run the generated script on your hosted server.
Jan 16, 2018 10:16 PM|wer246|LINK
Thank you Ryan.
I am using Visual Studio 2017 Community addition. I don't see a Tasks option when I right click on the database in any of the Solution Explorer, Server Explorer or SQL Server Object Explorer panes but you have put me onto a new path as I think that I've
come to the conclusion that VS2017 can't help me.
I've downloaded SQL Server Management Studio (V17.4), Connected to (LocalDb)\MSSQLLocalDB and expanded the databases hierarchy to find my database.
I right clicked on this, Tasks>Generate Scripts. From this wizard Next>Select specific database objects and then Select All> Specified file location, Next> Next. Report stated Scripts saved OK.
All I have to do now is edit the scripts and run them on my hosted database.