I'm trying to use a LocalDB as an alternative database for a Asp.net 4.6 Website I'm developing. The website will be installed using an install program on a customers web server.
Will the install program need to install SQL Server LocalDB or is it enough to simply copy the .mdf file during installtion and attach to that file in the SQL Server connection string?
Related
I've created an ASP.NET website which runs perfectly from Visual Studio. It connects to a SQL Server .mdf database file in the App_Data folder. I published the project using FTP. The live website cannot however connect to the database, as it is LocalDB, and my host uses a SQL Server (SqlException (0x80131904))
I uploaded an identical copy of the local .mdf database file from my computer to the host's SQL Server. I then tried to form a data connection with the server database from Visual Studio, however my host doesn't allow remote database access, for security reasons, resulting in error 40.
I'm using ASP.NET MVC in my application so I need access to the database to create models. My host has said "you can access SQL Server databases using ASP scripts running on your presence".
So my question is: how do I create models based on my host's SQL Server database when remote access isn't allowed?
When you're testing with Visual Studio, you should connect to the local copy of your database. When you're ready to publish your application, copy the database to the remote sql server and attach it. The copy of your application which is published should then connect to the uploaded database on that server.
That way you have one environment for testing and one for real use. There shouldn't be any need for Visual Studio to connect to the remote database.
P.S. To allow you to connect to different databases in different environments, usually you set your database connection string in the web.config file. So if you create different config transforms for each build configuration (e.g. debug and release) then visual studio will create the correct version of the config file when you do a Publish operation. See https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations for info about configuration transforms.
I have successfully deployed my asp.net web form application on appHarbor and also installed SQL Server.
But I don't know how to make database as I could not find any query box of shell where I can run my schema script.
A good way to do is to download the SQL Server express 2014 that will allow the connection with add-on that you install in https://www.microsoft.com/en-us/download/details.aspx?id=42299.
with the SQL management you can grab the Host Name as server name, then use sql authentication and put your username and password.
then you can manage all your database in your site, and in Visual Studio the only thing that you need to do is provide the connection string that appHarbor gave you and copy and paste to the web.release.config.
I programmed a web application that uses from local database (.mdf file) and would be run locally on client system.
my question is that what is the database needed to install on client system to run this application.
MS SQL Server?
MS SQL Server Express
or nothing?
I am buiding an internet web application using c# ASP.NET. I am using my own computer to develop the application. I've installed the oracle database on my computer. In order to deploy this application on the server, does the server have to install oracle client? I already included Oracle.DataAccess.dll in the bin folder.
Yes it does, assuming you're connecting to the database on the same server!
For example, you can connect to remote databases, but the point is where ever the database lives (server or PC), it will need Oracle installed.
The web server you will deploy your application to does not need to have Oracle server but it must have the Oracle client installed (Instant client for instance) + you will have to deploy your database to the Oracle server
If i have a server with ASP.NET 3.5 installed, where no one explicitly installed SQL Express. Can my web application still connect to an MDF file in the App_Data folder
No, you need SQL Express installed, see http://msdn.microsoft.com/en-us/library/ms165716.aspx.
You could always deploy your DB to another server which has SQL Server installed though. Just have to also update connection string.
You can do this if you are using SQL CE 4 though, http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx