SQL Server Express Deployment with C# Application - visual-studio-2010

I have written an application in C# using Visual Studio 2010 which uses SQL Server as it's back-end.
I would like to create a setup program for this application with all perquisites such as SQL Server Express and so on.
What I want is setup program to ask the user either to install the SQL Server Express or use the existing instance. If user opts for existing instance then Setup will ask for credentials and write the credentials in configuration file using encryption (Encryption class is already implemented).
If user opts for new instance installation, then setup will install the SQL Server Express with a specific Instance Name and also create the initial database. Setup will then use this instance's credentials in configuration file.
I am new to Setup and Deployment so please help me.
Thanks in advance

Related

How can I run my project on client pc without installing SQL server on client pc

I have developed a c# windows application which uses SQL server 2012 database in Visual Studio 2015 which is running well on my pc.
I am to install this application on a number of computers without SQL server installed on it, but when I run the application, its gives me database connection error.
My question is, how can I create the setup file to be able to run the app on those clients pc without installing SQL server on all those computers. Please I need your help.
Thank you.
Am Emmanuel.
Use an Azure database and have the clients connect to that.
Have a look at https://azure.microsoft.com/en-us/services/sql-database/
Alter your application connection string and make sure you keep the connection string secret.
Server=tcp:myserver.database.windows.net,1433;Database=myDataBase;User ID=mylogin#myserver;Password=myPassword;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;
An important fact is that the clients need to allow communication via port 1433.
If this is not an option create an API application and query the database via that.
If you need a private database per client you can use a database file and connect to the file
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15
Update based on reply
You can create a pop-up on the application allowing the users to add valid settings and credentials when your appsettings.json is blank or "a test connect" to the database fails.

Connect to Oracle Server from cloud Azure Application

I am pretty new to Windows Azure, I want to migrate existing web application that connects to remote Oracle server and run it as a cloud service web role how can I accomplish this while windows azure has no Oracle client installed by default ? or in other words how can I connect from within .net application to a 64Bit Oracle database server without installing oracle client ?
I have worked with Oracle client long time back so some of things below may not be right. But here are some of your options:
You could make use of Oracle client for .Net provided by Microsoft and add those assemblies references in your project. When you publish the project, make sure that Copy Local attribute on those assemblies are marked as true so that those DLLs get packaged along with the rest of your application.
If you're using Oracle provided client for .Net, I remember we had to install that application on our web server. In that case, you could make use of something called Startup Tasks in your webrole and install the package when your role starts. You could either include the installer as part of your package and then install the software using a startup task.

Cannot connect to AWS EC2 instance in Visual Studio

I have an AWS server (MS SQL SERVER EXPRESS 2008 R2 with IIS), with an elastic IP of 54.214.8.111, security groups configured with HTTP, MS SQL and FTP, and I can connect to the remote virtual machine using the rdp file that amazon gives you in the console.
However when I try to connect via visual studio to test if the database is working, it gives me a "Login failed for user 'dbuser' error. I have a user called dbuser on my SQL Server (on the server side of course) with full access permissions etc. I also cannot connect to an ftp on the server, despite all guides and help doc. Something seems to be simply blocking my connection. I have tried the same thing on multiple computers.
Everything seems to be configured correctly except I suspect the server instance.
Can anyone help? PS I'm fairly new to web development, this is my first AWS EC2 server.
[UPDATE] I just tried to create a new instance in a different location, same thing, maybe I don't know how to configure the SQL Server on the EC2?
It appears that by default EC2 SQL instances have SQL authentication disabled.
In SQL Management Studio, connect as the built in Administrator account, then go to
Server Properties>Security>
Under Server Authentication, change to "SQL Server and Windows Authentication Mode"
Restart SQL
Your local accounts should now work
Try running in elevated mode (right click Visual studio and run as Administrator), solved some issues I was having recently.

Sql Server Express failed to generate user instance

I am using Visual Studio 2010/c# and created an application where I am trying to access as a data source,a database which I created in SQLSERVER Express (via management studio).
I have several instances from previous installs which I remove -
SQL COnfiguration manager just shows 1 instance SQLEXPRESS which got installed as a named instance "mymachine/sqlexpress".
Named pipes, TCP/IP and remote clients are all enabled.
I am running under windows 7 64 bit and both the dev environment and sql are in the same PC.
When I try and configure the connection I go to the physical path where the file resides, add it but the test connection button fails with the msg failed to generate a user instance of sql server, only an integrated connection can generate an user instance
The solutions I found don't seem to apply.
User Instance is already enabled (set to 1) and I could not find any path to remove "old instances" there is only 1 path leading to the currently installed Instance.
Help would be appreciated
Using Visual Studio SQL Server database through IIS7,
they use default asp.net database.
Following might help,
Open IIS manager.
create a new application pool instead of using default application pool and keep your database in that.
Go to sql configuration manager > go to properties.
Select local system instead of built in system.
In the default browser option, Delete all the other files and paste your .asmx file.
See in actions. If anything is disabled, enable it.
Hope it helps. :)

Getting a ASP .NET MVC database working on a non-development machine?

This may be a basic question but I'm not very proficient in SQL Server.
I am Using Visual Studio 2008 Professional.
In a ASP .NET MVC 3 project I created a database that resides in 'App_Data'.
The web.config file uses this as the connectionString (partial):
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
When I copy the project to a the production server the initial MVC logon page appears ok. When I entire in the login username/password I get a
Failed to generate a user instance of
SQL Server due to a failure in
starting the process for the user
instance
error message.
The SQL Server Express 2008 instance on the production system is set use 'Local System' for authentication.
I think that I'm not configuring SQL Express or my web.config correctly?
UPDATE1
Most of the links found on the internet talk about deleting a folder. In my scenario there is no 'C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS' folder.
My solution for now (after much ASP .NET/IIS/SQL SErver security review) was to set "User Instance=True" to "User Instance=False" in the production web.config file.
Per your connection string, you're using Windows security to control access to the database. Does the account under which your web server runs have sufficient permissions on your database?
You may wish to test using SQL Server security, just to confirm this is the problem. (Assuming SQL Server was installed with SQL Sercurity enabled.)
Did you try this already? Fix error "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance."

Resources