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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:27:51+00:00 2026-05-11T07:27:51+00:00

I’m supporting a 3 year old windows service, (C# .Net 1.1) which uses Enterprise

  • 0

I’m supporting a 3 year old windows service, (C# .Net 1.1) which uses Enterprise Library to manage it’s connections to SQL server. The service monitors incoming messages, and does various tasks depending on the message, most of which involve updating a database. As far as I know, the service is single threaded, and reads messages out of a queue one at a time.

A couple of times in the last few days we’ve seen it ‘break’ randomly (last time at about midnight last night). During these times, some, but not all updates to the DB fail, (about 20% maybe), we see lots of warnings in the event log, and errors in our file logs (reproduced below). Restarting the service makes everything work perfectly again.

I’m thinking perhaps it’s something to do with the connection pooling in Enterprise Library? Is it possible Enterprise library is trying to maintain a pool of more connections than the DB server will allow it? But I can’t see why it would, and why it wouldn’t fail a bit more gracefully.

Is there a way I can get a bit more information out of my enterprise library logging as to the real reason for these failures?

Warnings in the event log look something like: (slightly edited)

     Source: Enterprise Library Data Service     Description: Data connection failed to open: server=ServerName;database=DatabaseNameintegrated security=true; 

Simultaneously, in the Error log file we see Null Reference exceptions from Enterprise library, when called from our service, something like this: (again, slightly edited)

     An exception of type 'System.NullReferenceException' occurred and was caught.     -----------------------------------------------------------------------------     02/17/2009 15:00:52     Type : System.NullReferenceException, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089     Message : Object reference not set to an instance of an object.     Source : System.Data     Help link :      TargetSite : System.Data.SqlClient.SqlInternalConnection CreateConnection()     Stack Trace :    at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)        at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)        at System.Data.SqlClient.SqlConnection.Open()        at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()        at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DBCommandWrapper command)        at OurCode.SomeFunction(MessageType message) in C:\someClass.cs:line 45        at OurCode.SomeOtherFunction(XmlReader message)      Additional Info:      MachineName : MachineName TimeStamp : 17/02/2009 15:00:52     FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.1.0.0, Culture=neutral, PublicKeyToken=a8dcbcfec587cc95     AppDomainName : OurCode.service.exe     ThreadIdentity :      WindowsIdentity : OurDomain\SomeAccount 

Earlier (in a previous ‘broken’ phase) we were seeing Exceptions like this one: (once again, slightly edited to be coy!). This is what made me suspect the connection pooling having problems. I think this is where our code logs it’s (non error) activity to a DB, but the enterprise library code can’t get a connection to the DB again (always coupled with the ‘Data connection failed to open’ errors mentioned previously.

     Sink failed because: System.NullReferenceException: Object reference not set to an instance of an object.        at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)        at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)        at System.Data.SqlClient.SqlConnection.Open()        at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()        at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DBCommandWrapper command)        at OurCode.Diagnostics.CustomDatabaseSink.ExecuteStoredProcedure(LogEntry logEntry)        at OurCode.Diagnostics.CustomDatabaseSink.SendMessageCore(LogEntry logEntry). 

Any help, especially pointers for getting more info out of our logging much appreciated.

Other background info: The windows service is written in C# .Net 1.1, and runs on a Windows Server 2003 box, under a domain account (which has all the right permissions to the DBs it needs). The DB server is SQL 2005, running in 2000 compatability mode (Yay legacy!), on Windows Server 2008.

  • 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. 2026-05-11T07:27:51+00:00Added an answer on May 11, 2026 at 7:27 am

    From what I can tell, this is happening when the internal connection object is being created in SqlConnection (you would get this using enterprise library or not, I believe).

    There are two things I would check. First is the obvious, are you disposing of all of your connections properly? Even though you are using connection pooling, you still must call Dispose on all of your connections when you are done using them so they are returned to the pool. If not, you could be looking at a starvation issue.

    If you are disposing of your connections properly, then I would look at the connection between that machine and the SQL Server, it would seem maybe you have connection problem there.

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

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure your use case is quite what SAML… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Programming against SAX is profoundly different to programming against DOM… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Using memcpy with a constant size What I have found… May 12, 2026 at 1:19 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.