In our project user using NHibernate 2.1.1 with SQL Server 2008 with .net 3.5.
I am facing strange problem with SQL Server. We developed windows service, installed it and it was running fine for sometime. Unfortunately by mistake when I stopped SQL Server, NHibernate throw exception
System.Data.SqlClient.SqlException: 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)
But after restarting the SQL Server, it is unable to connect to the SQL Server, still throwing the same error. But I am able to connect SQL Server through Query Analyzer / Management Studio.
Please any body can help me in solving the problem?
Thanks
nRk
I know you already an answer but I got the same error but the solution was different, maybe this will help someone else.
When I was setting up ASP.Net to store the session variables in a DB I got the same error
provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
The cause of my problem was the database couldn't be found on the SQL Server I was connecting to. Once I create the database correctly everything worked correctly.
Given the cause of the problem I would have expected the error message
provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With