Named Pipes Provider, Error: 40 - Failed to open a connection to SQL Server?

In our project, the user uses NHibernate 2.1.1 with SQL Server 2008 with .net 3.5.

I am having a problem with SQL Server. We developed the Windows service, installed it, and it worked fine. Unfortunately, by mistake, when I stopped SQL Server, the NHibernate exception was thrown

System.Data.SqlClient.SqlException: A network-related or specific instance failed while creating a connection to SQL Server. The server was not found or was unavailable. Verify that the instance name is correct and that SQL Server is configured for a remote connection. (provider: Named Pipe Provider, error: 40 - Could not open SQL Server connection)

But after restarting SQL Server, it cannot connect to SQL Server, still throwing the same error. But I can connect SQL Server through Query Analyzer / Management Studio.

Please, can any body help me in solving the problem?

thanks

NRK

+4
source share
5 answers

Go to \ Start \ Programs \ Microsoft SQL Server 2008 \ Configuration Tools, start SQL Server Configuration Manager, and enable the necessary connection protocols.

+1
source

I know that you already answered, but I have the same error, but the solution was different, maybe this will help someone else.

When I configured ASP.Net to store session variables in the database, I got the same error

provider: named pipe provider, error: 40 - Could not open SQL Server connection

The cause of my problem was the inability to find the database on the SQL Server that I was connecting to. When I create the database correctly, everything works correctly.

Given the cause of the problem, I was expecting an error message

provider: SQL network interfaces, error: 26 - Search for errors Specified server / instance

+1
source

check the following (a) First, it follows that the database service of this instance is starting ... use Configuration Manager (b) if the service is running, check if it is a named instance. in this case, the SQL Server Browser service is running. (c) Remote connection verification is enabled for local and remote CONnection using TCP / IP - using the SQL Server surface configuration tool to view and configure (d) Check all protocols or not - Use SQL Configuration Manager - SQL Server Network Configuration - Protocol for MSSQLSERVER - enable TCP / IP and NamedPipe

0
source

I had to "Scroll to the end and set the TCP port under IPAll (default is 1433)," as indicated in this answer

How can I make MS SQL Server available for connections?

0
source

In the Sql Server Configuration Manager program, start SQL SERVER, enable the TCP / IP connection. If necessary, enable the port in the firewall.

0
source

Source: https://habr.com/ru/post/1313846/


All Articles