Cannot connect to AWS EC2 instance in Visual Studio - 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.

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.

TFS could not connect to database. Login field

I am getting the following error. Cannot solve.New to TFS. Please help.
TF246017: Team Foundation Server could not connect to the database. Verify that the server that is hosting the database is operational, and that network problems are not blocking communication with the server.--> login failed. Login from untrusted domain and cannot be used with windows authentication.
If you open SQL Server Manager on your TFS Server application tier using "runas" to open it under the same credentials that you expect TFS to use you should be able to diagnose more:
1) install SQL Server Manager on TFS AppTier
2) right-click on the SQL Server Manager icon and select 'run-as' ( you may need to hold alt)
3) enter the TFS Service (refer to TFS Installation Guide) credentials to open
4) try to connect to your SQL Server
If you cant connect verify that SQL is installed where you think it is and that there are no firewall issues for the standard SQL ports.

Can't login to SQL Azure Management

Actually i have following step by step from http://www.windowsazure.com/en-us/manage/services/sql-databases/getting-started-w-sql-databases/ to create database and etc.
But when i try to login using username and password which i have configured,message error appear " Failed to retrieve connection information. Try to login again. "
I have configure firewall before to allowed my public ip to access the database.
How to solve my problem ?
Thanks
Clear your cookies and browsing history and contact Microsoft support if this persists after some time (like an hour)
That is very interesting problem.
What about checking connection with Microsoft SQL Server (can be Express edition).
If you configured firewalls then you should be able to access Azure database via Microsoft SQL Server Management Studio from your system with no problems.
Alternatively you could check Visual Studio. But I am not sure if Visual Studio Express edition can connect to Azure databases (you might need some paid version).
If you still have some connectivity issue using SQL Management Studio then that would indicate some networking problems between your place and Azure data centre. In that case I would recommend spinning up another Azure database (for very short time) in different data centre, set up firewalls and see if that will work.
EDIT
Any way to configure Firewall for Azure ?
Firewall to database cannot be configured at a level of individual databases; it needs to be configured at a level of server.
In Windows Azure Management portal, go to Database tab and then select database server:
Once you in server dashboard, select configuration top tab. You can change DB Server firewall allowed IP addresses under Allowed IP Addresses
In the same section there is Current Client IP Address which tell you the current IP. That very handy when you work with VPN or change your network quite often.
Allow popups. Chrome was blocking this from me.

How do I authenticate to a SQL Server database on a domain from a virtual machine off the domain?

I am supporting a .NET 4.0 (Visual Studio 2010) web application that authenticates to a SQL Server 2008 database which resides on my work intranet. The application authenticates to the database using windows authentication. Thats all fine and dandy if Im developing on my host, but I am developing on a virtual machine that is not on the work domain. Thus when the project build and runs, it throws a SqlClient.SqlException
"Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
Short of developing on my host and abandoning the VM, what can I do to avoid this error and successfully authenticate to the database so I can build/run the web app? I am willing to store my credentials somewhere locally, though preferably not somewhere that would be under TFS source control (like the web.config) because I couldnt keep the file checked out since there are other developers on the project.
I have tried running Visual Studio as a different user (as the user on my work domain) but I get a "unknown user name or bad password" error.
Note, adding the Virtual Machine to the domain (or connecting to it via VPN) are not options. The VM must remain off the domain. Also note, the virtual machine is running on the computer that is on the domain, and the VM uses a shared connection. So it CAN access the intranet but it can't perform windows authentication to SQL Server.
You can run Visual Studio (or SQL Server Management Studio) as the user on the domain. The trick is, you have to use the “/netonly” option of the “runas” Windows tool, so that you can run as a domain user on a non-domain machine.
Namely, in a command prompt you run this command (filling in your own criteria):
runas /netonly /user:<Domain>\<User_Name> "<Your_Program.exe>"
Alternatively, you can create a shortcut on your desktop, and set this command as the shortcut target. Upon running the shortcut/command, you enter your credentials when prompted and visual studio (or whatever program you like) will run as the domain user.
Join the domain using vpn connection if possible. Vpn can connect you with specific domain credentials. Alternative would be connecting using SQL Server Authentication if SQL Server is configured with mixed authentication.
From what I understand, you have several options:
You could add a user account to the SQL db to allow password authentication
Have the VM join the domain
Create an SSH tunnel to the host SQL server port

AppFabric Installation Problem

Hoping someone else has already encountered this and has a solution...
I'm trying to install the AppFabric Beta 1 caching service, on a virtual Windows Server 2008 (CacheServer1). My cache configuration information will be held in a SQL Server database on a separate server (SQLServer). As AppFabric only supports Integrated Security for SQL Server, both servers are in the same domain, and I'm installing using an account that has db_owner rights to my VelocityConfig database.
When I run the AppFabric installer and get to entering the connection string for my SQL server, I put in the server name, but when I click the combo box to get the list of databases from the server, it thinks for a minute and then I get a timeout error.
Both servers can ping each other, and I've created a .UDL file on CacheServer1 under the same user, which can connect successfully to SQLServer and retrieve a list of databases.
Can anyone suggest what I need to do to get the installer to succeed?
The solution I found to this was to install the SQL 2008 Client Connectivity bits on CacheServer1, once this was installed I could get a list of databases. Still can't get AppFabric to install successfully but that's another problem for another question I think...
To ensure that there is no network/DNS issues, can you try the following:
1. Use IP address instead of hostname.
2. Are you able to connect to sql server via sql server mgmt studio running on CacheServer1?

Resources