Application is unable to connect to database - sql-server

I have a development-environment (dev) on which I have my .Net-application running which contains a RoundHouse-project to keep the database up to date. The database is running on the same machine. There are no problems with dev.
I also have a test environment with the same application and also a copy of the database. To keep the database on the test-environment up to date I run the RoundHouse-project from dev using the connectionstring to the database on the test-environment.
This always worked fine but for some reason when I now run RoundHouse with the connectionstring to the test database I get the following error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
Funny thing is that when I recreate the connectionstring using a .udl file using the same properties and credentials I am able to connect to the test-database.
Running the webapplication using that same connection results in the same error.
I have already checked all the settings in the SQL Server Configuration Manager and made sure TCP/IP and Named Pipes are enabled.
I can ping the server and can connect to it using Remote Desktop.

Related

Unable to connect to SQL Server from Excel to generate reports. Named pipes and tcp/ip are enabled. using trusted connection

Trying to connect to SQL Server from Excel by using >>Data tab, >>From other sources >> from SQL server. It came back with the attached message
I made sure named pipes and TCP/IP are enabled in the SQL server configuration manager. It works on my laptop. But my friend is trying to install in her laptop and it is not working. Appreciate any ideas you can share with us. We are doing Developer Edition, custom install of the database server. Double checked the instance name and made sure remote connection is allowed.
This is the error message I get
Unable to connect:
We encountered an error when trying to connect.
Details : Microsoft SQL: A network-related or instance specific error occurred while establishing a connection to SQL-SERVER. The server was not found or was not accessible. Verify if the instance name is correct and SQL server is configured to allow remote connections. (Provided:Named Pipes Provider,error:40 Could not open a connection to SQL Server.

UWP cannot connect to local SQL Server

I'm creating a simple UWP application working together with my local DB server I set up with SQL Server Management Studio.
I can successfully set up a connection in the server explorer and run queries in the DB:
However when I run the application I get an error when the connection is being established:
System.Data.SqlClient.SqlException HResult=0x80131904 Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) Source=Core .Net SqlClient Data Provider
I'm not sure if it's a problem with the connection string or what else it could be. I checked the firewall settings and everything seems to be fine. The SQL server settings also allow for remote connection.
Which SQL Server version is running?
Have you tried with the following connection string format?
Data Source=.\\MSSQLServer;Initial Catalog=PapaDario;Trusted_Connection=yes;
Before you connect to your database, some aspect of the SQL Server configuration needs to be changed. First, ensure that you've enabled TCP/IP for SQL Server. You can do that in the Computer Management console. Then make sure that your SQL Server Browser service is running.

Dotnet core application cannot connect to SQL server using IIS, only when using IIS Express or Kestrel

I have a .NET Core web application that fetches some data from a SQL Server. I connect to the SQL Server over the internet.
When I run the application with IIS Express or Kestrel, I can connect to the database server and retrieve data. I can also successfully connect to the database server using SQL Server Management Studio.
Here is the connection string I'm using:
"ConnectionStrings": {
"DefaultConnection": "Server=my-sql-server.someurl.com; Initial Catalog=my-sql-database; User ID=my-user-id; Password=my-password;"
}
But when I try to run the same website, on the same machine, in IIS, I get the following error message:
SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)
I'm suspecting this has something to do with the dotnet core/IIS combination, and not a firewall/network/authentication issue, but I might be wrong.
The issue was simply that I was looking at the wrong connection string.
I have appsettings.json containing one connection string and appsettings.Production.json containing another.
When running the application with IIS Express or Kestrel, the first one is used, but when I publish the app and then run it under IIS, the environment is set to Production, and the production settings are used instead.
The problem was that the production connection string pointed to a database server that didn't exist anymore.
I solved this issue by adding LocalSystem to Identity in Web site Application pool.
Steps:
Select website application Pool
Right click and click Advanced Setting
Click on Identity, and change it to LocalSystem
You need to enable TCP/IP protocol on sql server. Please use following link:
Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

ASP web application could not connect to remote server

I have classic asp web application on server 2012. It throws error saying could not connect to SQL server.
Error: A network related or instance- specific error occurred while establishing the connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL server is configured to allow remote connections.
When I checked SQL configuration manager, Shared memory, TCP/IP & Named Pipes are all enabled. And also when I run queries on that server, all queries are executed successfully. But when trying to connect itself, it could not connect to server. My connection string is correct. Please help me.

how to deploy SSIS package in vitual machine(azure) from local machine?

I have created SSIS package and I can able to deploy in my local server as well using SQL Server 2012. but when I try to deploy the package in virtual machine (azure) server I am getting the error:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 53)
Is there any way to do the deployment in virtual machine server?
I believe the only way is to deploy the packages manually. By this I mean copying and pasting to a shared folder on the server. Make sure connection managers are set up to use environment variables so that you can deploy between environments without having to change configuration settings

Resources