0

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:

  1. The OP is not using the using statement on his SQLConnection.
  2. The OP is unaware of ConnectionTimeout or CommandTimeout.
  3. 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...

SchmitzIT
  • 9,227
  • 9
  • 65
  • 92
Mr. Smith
  • 4,288
  • 7
  • 40
  • 82
  • I would recommend a stress test (using unit tests maybe?) to see if the behaviour is as erratic as it seems, for the information you provide here is not nearly enough to provide a solution. Is your application, a web implementation on .Net Forms or MVC? What is the version of MsSQL you are using etc? – Athanasios Kataras Nov 28 '12 at 14:46
  • There's two applications that use this same code; one is a .NET console application, the other is an IIS ASP.NET website. Come to think of it, I've never seen this error thrown from the console application (and it handles more transactions than the website does). Perhaps IIS overrides connection pooling settings? – Mr. Smith Nov 28 '12 at 16:27
  • have you seen http://stackoverflow.com/questions/1421978/help-troubleshooting-sqlexception-timeout-expired-on-connection-in-a-non-load ? It might help you – Athanasios Kataras Nov 29 '12 at 12:04
  • Yah, I saw that a while back; it sounded like the same issue as me, but the "lack of memory" hypothesis had almost no rationale (I wasn't convinced then, and still not convinced now). – Mr. Smith Nov 30 '12 at 00:39

0 Answers0