ASP.NET 2.0 - Sleeping connections staying open

G

Guest

I'm wondering how widespread this problem is.

I had an application written in ASP.NET 1.1.
It worked fine.

Then I converted it to ASP.NET 2.0.
Now, I'm getting the error that I've seen others mention.
Specifically, sleeping connections (SQL Server) aren't getting closed and
after a period of time (about a day for my app) the app crashes because the
maximum number of connections has been reached.

All connections were explicitly closed in the code, but I sttil got the error.
Finally, I modified my vode to dispose every single connection after use.
This fixed my problem.

However, this seems to be an extreme fix which creates unnecessary overhead
on the SQL Server.

Who else is seeing this?
Is this a bug in ASP.NET 2.0?

-Adam
 
J

Juan T. Llibre

Here's your solution :
Finally, I modified my code to dispose every single connection after use.

That is a "best practices" recommened procedure.

re:
Is this a bug in ASP.NET 2.0?

Given that you fixed it in code, no, it's not an ASP.NET issue.
 
M

Mark Rae

Finally, I modified my vode to dispose every single connection after use.
This fixed my problem.

Quite so - that's what you should have been doing from the start...
However, this seems to be an extreme fix which creates unnecessary
overhead
on the SQL Server.

Disposing connections creates no overhead on the SQL Server - quite the
reverse...
Is this a bug in ASP.NET 2.0?

No.
 
G

Guest

You may be confusing the connections you see in Enterprise Manager with your
ADO.NET SqlConnection object you use in your code.

Your SqlConnection should ALWAYS be closed immediately after use. This
allows the connection to return to the pool. Provided the connection strings
you use are all the same, that is the most efficient "best practices" coding
pattern.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top