ASP.NET 2.0 - Sleeping connections staying open

Discussion in 'ASP .Net' started by =?Utf-8?B?QWRhbQ==?=, Aug 15, 2006.

  1. 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
    =?Utf-8?B?QWRhbQ==?=, Aug 15, 2006
    #1
    1. Advertising

  2. 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.



    Juan T. Llibre, asp.net MVP
    aspnetfaq.com : http://www.aspnetfaq.com/
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en espaƱol : http://asp.net.do/foros/
    ===================================
    "Adam" <> wrote in message
    news:...
    > 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
    Juan T. Llibre, Aug 15, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?QWRhbQ==?=

    Mark Rae Guest

    "Adam" <> wrote in message
    news:...

    > 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.
    Mark Rae, Aug 15, 2006
    #3
  4. 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

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Adam" wrote:

    > 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
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Aug 15, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jan nielsen

    Re: asp.net mysql sleeping processes

    jan nielsen, Jul 23, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    485
    jan nielsen
    Jul 23, 2003
  2. cmay

    Sleeping a thread in ASP.NET?

    cmay, Jun 20, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    713
    Mike Labosh
    Jun 21, 2005
  3. Michael Scovetta
    Replies:
    0
    Views:
    3,086
    Michael Scovetta
    Jun 4, 2003
  4. Patio87
    Replies:
    4
    Views:
    406
    Julie
    Aug 18, 2004
  5. jobs
    Replies:
    2
    Views:
    880
Loading...

Share This Page