must always restart sql server when connecting with different client - sql-server

After a BSOD the sql server doesn't work normal anymore.
I must restart the SQL SERVER (SQLEXPRESS) service every time I'm connecting with different client (application)
e.g: When I'm connecting with the software I developed it connects, then when I connect with SSMS it can't: I must restart the sql server service to let it connect. And when I'm connecting in SSMS first, my software can't connect: I must restart the service.
Here's the error:
TITLE: Connect to Server
Unable to connect to .\SQLEXPRESS.
------------------------------ ADDITIONAL INFORMATION :
The client was unable to establish a connection due to an error during
the connection initialization process. Common causes include attempts
to connect the client to an unsupported version of SQL Server, a
server too busy to accept new connections, or a resource limitation
(memory or maximum number of allowed connections) on the server.
(provider: Shared Memory Provider, error: 0 - There is no process at
the other end of the channel.) (Microsoft SQL Server, Error: 233)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
There is no process at the other end of the pipe

Related

ADF Copy Actitity issue

I have an issue where I can preview data from a source, a SQL Server connected through a Self-Hosted IR, but I cannot copy the data to a sink (Azure SQL DB on an EP).
The user account at the SQL Server level has access to the relevant tables, as can be verified by the fact that I can preview data. The sink side dataset also works, as I can use with similar data sources to the source.
If I, for example, try to fetch two specific rows, I can see them in the preview, but it takes 5 minutes for ADF to give an error message which is wildly misleading:
ErrorCode=SqlFailedToConnect,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot connect to SQL Database: 'ServerName.database.windows.net', Database: 'DatabaseName', User: 'AdminUserName'. Check the linked service configuration is correct, and make sure the SQL Database firewall allows the integration runtime to access.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.),Source=.Net SqlClient Data Provider,SqlErrorNumber=10060,Class=20,ErrorCode=-2146232060,State=0,Errors=[{Class=20,Number=10060,State=0,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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.),},],''Type=System.ComponentModel.Win32Exception,Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond,Source=,'
What am I doing wrong? Is there some setting I am missing?
Please check whether the Azure SQL DB(sink) is accessible from the server on which you have installed the self hosted IR.
YOu would need to whitelist the IP of the Self IR server in Azure SQL DB firewall rules and make some port opening in the IR server for Auzre SQL DB to be accessible.
Basically in case if an IR is being used in a copy activity, both the source and sink must be accessible from the server on which IR is set up

SQL Server 2012 Express error: can not connect and start local db

I have installed SQL Server 2012 Express version where I have a local db instance separately. When I connect to SQL Server Express, it connected without problem, but when I try to connect to local db, I get the following error:
The attempt to attach to the database failed with the following information: 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:2)
The system cannot find the file specified.
When I open SQL Server Configuration Manager, the local db service is not running but it is stopped. When I start that it shows error
The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details
When I open its properties and select log on as built in with local system after clicking apply it shows error
The process terminated unexpectedly.[0x8007042b].

Accessing SQL Server from Azure DevOps Pipeline

Problem
I have setup an Azure Pipeline, and the problem I have is that during the Test Assemblies part of the Pipeline it is failing as it can't resolve the connection string/find my SQL Server.
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) ---> System.ComponentModel.Win32Exception: The network path was not found
In this scenario, I want to avoid creating a mock and ideally have the code directly communicate with SQL Server.
The SQL Server is sat on an Azure VM, so it's not a 'Azure SQL Database' service.
What I've Tried
I have opened the ports on the Azure VM to allow traffic from all regions/IP ranges used by Azure DevOps (I have found online that this is required). I have also tried pointing the connection string inside the Pipeline 'Test Assemblies' to a different (on-premise) windows server which holds an instance of SQL Server, but it is still not able to find/connect to SQL.
When connecting to SQL from my local (both the Azure VM and on-premise server) I can connect. We also have a few other services using the SQL Server sat on the Azure VM, so I am confident that the connectivity issue is with connecting from an Azure Pipeline.
Has anyone had this issue before?
Update
I have updated the connection string to directly refer to the port i.e.
**.***.**.***,1433
And the error message has now changed to:
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 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception: The wait operation timed out
I now have it working.
After having the Azure DevOps region changed from West Europe to UK South, my DevOps can now communicate with SQL Server on my VM (with the required IP addresses white listed as per Leo Liu-MSFT's comment).

HTTP Error 500.30 - ANCM In-Process Start Failure - An error occured during migration

I have read this thread, however unfortunately couldn't find the solution to my problem. I have an ASP.Net Core project (that's called Rent) and it works without any problem on my local machine. However, once I publish the project to the IIS (still in development mode) I get the below error
fail: Rent.Program[0]An error occured during migration
Microsoft.Data.SqlClient.SqlException (0x80131904): 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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
---> System.ComponentModel.Win32Exception (0x89C50118): Unknown error (0x89c50118)
The connection string is called DefaultConnection and is the environment variable. Can anyone help me please? Can provide any additional information if required.
The first thing you should check is that your SQL Server instance is up and running and that your database is still available. This error means quite literally that it can't establish a connection to SQL Server from the Secret Server application.
And you can also check follow things in your environment:
Is something blocking the connection between your Secret Server server and SQL Server?
The standard SQL port is 1433. Check with your server administrator - is the Windows Firewall in use, blocking this port on your SQL server? Check with your network administrator - is there a firewall at some point in between that has closed off this port? Keep in mind that if you use a custom port for SQL, it need to be specified the Secret Server database connection using a SQLSERVER,port type of format.
On the server hosting your SQL Server database, is the SQL Server
service running?
Open services.msc or SQL Configuration Manager to view the status of your SQL Server service.

No process is on the other end of the pipe error when trying to connect to SQL Server database through VB.NET application

I have a SQL Server database which I connect to from my VB.net client application.
Everything works fine in most of the systems. But in a few new VMs the client application is unable to connect to SQL Server and it throws the error mentioned below. The strange thing is that I can use the same credentials (SQL Server authentication) to connect through SQL Server Management Studio in the same system.
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe.)
The sample connection string used is as below
Data Source=[server name];Initial Catalog=[db name];Persist Security Info=True;User ID=[username];Password=[pass]
I have checked similar answers and have already tried the following
Made sure SQL Server is accepting remote connections
Made sure TCP and Named Pipes are enabled in SQL Server
Started SQL Server Browser service
Tried specifying IP address instead of server name
By reading related articles, some of them point eventually to SSH, TLS1.1 and TLS1.2 issues. I also suspect firewall, but because I do not have admin rights to the system, I am not able to check the inbound and outbound rules.
Any suggestions would help.

Resources