Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 358765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:19:50+00:00 2026-05-12T12:19:50+00:00

An asp.net application I am working on may have a couple hundred users trying

  • 0

An asp.net application I am working on may have a couple hundred users trying to connect. We get an error that the maximum number of connections in the pool has been reached. I understand the concept of connection pools in ADO.NET although in testing I’ve found that a connection is left “sleeping” on the ms sql 2005 server days after the connection was made and the browser was then closed. I have tried to limit the connection lifetime in the connection string but this has no effect. Should I push the max number of connections? Have I completely misdiagnosed the real problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:19:50+00:00Added an answer on May 12, 2026 at 12:19 pm

    All of your database connections must either be wrapped in a try…finally:

    SqlConnection myConnection = new SqlConnection(connString);
    myConnection.Open();
    try
    {
    }
    finally
    {
       myConnection.Close();
    }
    

    Or…much better yet, create a DAL (Data Access Layer) that has the Close() call in its Dispose method and wrap all of your DB calls with a using:

    using (MyQueryClass myQueryClass = new MyQueryClass())
    {
       // DB Stuff here...
    }
    

    A few notes: ASP.NET does rely on you to release your Connections. It will release them through GC after they’ve gone out of scope but you can not count on this behavior as it may take a very long time for this to kick in – much longer than you may be able to afford before your connection pool runs out. Speaking of which – ASP.NET actually pools your connections to the database as you request them (recycling old connections rather than releasing them completely and then requesting them anew from the database). This doesn’t really matter as far as you are concerned: you still must call Close()!

    Also, you can control the pooling by using your connection string (e.g. Min/Max pool size, etc.). See this article on MSDN for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a ASP.NET application to use windows authentication. I have disabled
I have an ASP.NET application I am working on. One of the requirements of
I am working on localization for a asp.net application that consists of several projects.
I have asp.net mvc 2 application. Now I'm reimplementing it for working with Ninject
I am working in ASP.NET 3.5 MVC application. We have a functionality where we
I'm working on an asp.net application that allows the user to update data for
I have an ASP.NET Web Application project that I am using to host a
I have a ASP.NET application running on Windows 2003 that needs to communicate with
I am working on an ASP.Net web application that must print dynamically created labels
I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.