Reputation: 183
I have a ASP.NET application that connects to a SQL server backend on another server. At random points throughout the day I will get a message when logging into the application that states:
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)
This may happen 2-3 times per day and will last about 30 minutes or so. The everyting will run fine for a few more hours until it happens again. The crazy thing about it is that I cannot even ping the server using its hostname while this error is occurring. I can ping it by the IP address though. Once the web application can connect again I can ping the server again by its hostname.
Even stranger is that I have another web application that is running on the same webserver and uses the same SQL server database as a backend that continues to function while the other web application is generating the error.
Each application is running on a different application pool on IIS 6 (Recyclying the affected app pool does not appear to resolve the problem). Both applications run on .NET 4 and the webserver is Windows Server 2003. The database is running on SQL Server 2008.
Any ideas what my issue could be?
Upvotes: 1
Views: 1797
Reputation: 46067
Looks like a DNS issue, and it probably has nothing to do with your code. Can you use the IP address in your connection string instead?
Upvotes: 1