I have a .net web application that calls sql server 2008 running on a different server. From last couple of weeks, after every 4 or 5 days, web applications connectivity to sql server becomes an issue. Web application fails to connect to sql server intermittently. In the event viewer of the web app server, following message is logged:
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) at System.Data.SqlClient.SqlInternalConnection
Trying to create an ODBC connection to the sql server from the web application server also fails with similar message:
Connection failed:
SqlState:'01000'
Sql server error: 68
[Microsoft ODBC Sql server driver][DBNETLIB] ConnectionOpen(Connect())
Connection failed:
SQLState:'08001'
Sql server error: 17
[Microsoft ODBC sql Driver]{DBNETLIB] Sql server does not exist or access denied
However other machines (except web app server) are still able to call the same sql server instance and are also able to create an ODBC connection to the sql instance. I can also successfully ping to SQL server from web app server when the connectivity issue occurs.
Strangely web application doesn't looses the connectivity permanently. Every couple of minutes some request will be able to connect to sql server but then it will fail again. Recycling the web application pool or restarting the iis doesn't resolve the issue. However, after the web server is started, the problem goes away for few days only to resurface later.
Any ideas what might be causing the issue. Thanks