I have a windows service running on my workstation that is part of a vendor supplied tool that connects to a database. It will not startup the error I get 4 errors in the event log with the following inner exception:
Inner Exception
---------------
Type : System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source : .Net SqlClient Data Provider
Help link :
Errors : System.Data.SqlClient.SqlErrorCollection
Class : 20
LineNumber : 0
Number : 53
Procedure :
Server :
State : 0
ErrorCode : -2146232060
Data : System.Collections.ListDictionaryInternal
TargetSite : Void OnError(System.Data.SqlClient.SqlException, Boolean)
Stack Trace : at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
Of course the key thing of note is (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
However, if I do a runas /user:serviceuser cmd
I can connect via named pipes to server just fine:
C:\Windows\system32>sqlcmd -S np:\\%%SERVER_NAME%%\pipe\sql\query
1> SELECT @@servername, db_name()
2> go
--------------------------------------------------------------------------------
------------------------------------------------ -------------------------------
--------------------------------------------------------------------------------
-----------------
SERVER_NAME
master
(1 rows affected)
What other troubleshooting steps do I take?