SQL Server 2014 – Named Pipes Clarifications

availability-groupssql server 2014

Currently,SQL Services are using TCP IP protocol. Named pipes protocol is disabled. I am facing issues while running my application status as below :

An error has occurred while establishing a connection to the server.
(provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)

My Question is ,Will there be any issue if I enable Named Pipes now because I restarted the Named Pipes and restarted SQL Service and issue seems to be resolved. But I am confused why we are getting Named Pipes issue when TCP IP is enabled. Does SQL Server need both TCP IP and Named Pipes to be enabled ?

Thank you

Best Answer

It's because,

When a client tries to make a connection, it uses the protocols order by priority defined by SQL Server configuration manager. A low value means a high priority. If you configured TCP/IP as first priority and SQL Server is not able to resolve Name to IP it raise the error you posted. But when you disable TCP/IP, then because TCP/IP with first priority is disabled client uses Named Pipe (with second priority) to connect to SQL Server. And get a successful connection.

Here, you can set the priority of protocols by moving it UP or DOWN.

enter image description here

Thanks