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 747159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:10:24+00:00 2026-05-14T14:10:24+00:00

In Our project I have used LINQ to SQL for every kind of database

  • 0

In Our project I have used LINQ to SQL for every kind of database interaction. Now from what I know , When I create and use DataContext object : it opens the connection , crates a transaction , perform the query and closes the connection.

Every now and then we are getting Connection pool error on our services and Server.

” The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. “

Any idea ? Am I completely off here ? Is this related to SQL Server itself ?

We are using LINQ , .Net 3.5 and Sql Server 2008

NOTE: NO DATAREADER IS BEING USED ANYWHERE IN SYSTEM.

Thanks

  • 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-14T14:10:24+00:00Added an answer on May 14, 2026 at 2:10 pm

    See here:

    When should I dispose of a data context

    I’m quoting Jon Skeet quoting someone else here, but it was a surprise to me as well, since we ran into a similar issue.

    The logic that automatically closes
    the DataContext connection can be
    tricked into leaving the connection
    open. The DataContext relies on the
    application code enumerating all
    results of a query since getting to
    the end of a resultset triggers the
    connection to close. If the
    application uses IEnumerable’s
    MoveNext method instead of a foreach
    statement in C# or VB, you can exit
    the enumeration prematurely. If your
    application experiences problems with
    connections not closing and you
    suspect the automatic closing behavior
    is not working you can use the Dispose
    pattern as a work around.

    Basically, the mechanics of how the datacontext closes itself aren’t bulletproof. I’ve since taken to closing it manually, which fixed our problem.

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

Sidebar

Related Questions

In our project we have requirement that, after receiving sms message from third party
We have used WPFToolKit and PresentationFramework 4.0 in our project. There are some common
We have received a WSDL from our client that we use to communicate with
We have been using Spring Remoting in our project for sometime. It is used
We have a smelly code in our project. A lot of values which used
I have strongly typed entity class, which is used for Linq-To-Sql: [Table(Name = _Reference2)]
In our project we use both VB.NET and C# code. Now, Microsoft seems do
So our project use PostgreSQL database and we use JPA for operating the database.
We have some XSDs in our project that define types that use attributes, as
In our project, we have a class KnowledgeBaseManager, which gets used by other classes

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.