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

  • Home
  • SEARCH
  • 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 7535677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:21:53+00:00 2026-05-30T06:21:53+00:00

I have an issue with a windows service that accesses a SqlServer 2005 database.

  • 0

I have an issue with a windows service that accesses a SqlServer 2005 database. Every Monday it crashes with an InvalidOperationException: Timeout expired. 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.

I’ve checked all the obvious things like closing the db connections and readers and found no problems.

The strangest thing is that in the last case I set up perf monitor to record the number of connections in the pool and things like that and found that the Sql Server actually went down a few days before the service crashed, so all the SQL counters showed 0 (the service handles SQL Server stopping and tries to connect every few seconds until it reconnects successfully).

Before the SQL server was stopped, the amount of open connections was 1-2 all the time, so it really doesn’t seem to be a problem with the connection count.

I’ll be investigating the SQL Server logs for clues, but maybe you can give me an idea about what might be causing this exception if the actual number of connection is not a problem.

Update:

Checked the logs and it seems that the Sql Server wasn’t down all the time. On Thursday it was stopped, but was restarted on Friday. The restart caused the SQL counters in perf mon to stop reporting data, so I have no real data about the number of connections at the time of the crash.

  • 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-30T06:21:55+00:00Added an answer on May 30, 2026 at 6:21 am

    Eventually Google helped me find a solution for this one. As per this blog this exception can occur when 2 or more threads try to access a not responding SQL server instance at the same time. It is enough to wrap the conn.Open() call in a lock and the error is gone.
    Bizarre but works.

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

Sidebar

Related Questions

Having an issue with a Windows service that needs to monitor/have access to a
I have a Windows Service that does the following when started. When running via
I have a WCF service that is running as a windows service. As soon
I have a Windows Service that retrieves messages from a RabbitMQ queue. The service
I have an executable that is started by a windows service, this program will
I have a windows service that hosts the main WCF service. The clients for
I have a windows service , that takes files with metadata(FIDEF) and corresponding video
I have c# that will run in a windows service. I'm trying to use
I have a .NET 3.5 Windows Service. I'm testing with a small application that
We have a Windows Service that makes a WCF service call. Normally, it works

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.