Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Are you testing using runas from the same server as the one which is running the application? –  Rob Watkins Aug 16 '11 at 21:13
    
Correct, I am doing the runas from the same machine running the service. Therefore, my sqlcmd is running from the same host as the service, using the same credentials, connecting to the same database server, using the same network protocol, to the best of my knowledge. –  Justin Dearing Aug 17 '11 at 13:00

1 Answer 1

up vote 1 down vote accepted

Check Ring Buffers output for Connectivity errors and also check the error log if you see a Login Failed error message. Check the login that the tool is using and see if you can login into the SQL instance using the same login. Also find out the server name that they are providing to see if they are using an alias.

share|improve this answer
    
As stated in my question, I am running sqlcmd as the user the service is running as. I am looking at ringbuffer and aliases. –  Justin Dearing Aug 16 '11 at 17:54
    
It was an alias issue. Some connections were not being made with the fqdn, so I had to add the domain suffix to the domain suffix search list. –  Justin Dearing Aug 17 '11 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.