I run a server that is active 24/7, and on very rare occasions (only happened once or twice the past month) my web server will fail to connect to my SQL Server database (hosted on the same server). The server is not under heavy load, and no other errors seem to be occurring.
Now, I know what you're thinking; this is likely caused by one of three things:
- The OP is not using the
using
statement on his SQLConnection. - The OP is unaware of ConnectionTimeout or CommandTimeout.
- The OP is using some bizarre connection string, or is incorrectly formatting it.
Well, it's neither of these three. And since I'm using VS2008 instead of VS2003, it's also likely not You receive a "Timeout expired" error message when you run a Visual Studio .NET 2003 application.
If you've got a suggestion that isn't 1
2
or 3
, PLEASE post it. I can't post code samples today (not on the development computer), but I might be able to find my MSDN SQL Server support forum post if you really need to see the (roughly) 7 lines of C#. If you're asking for the code though, you're probably presuming it's 1
2
or 3
though...