SemaphoreFullException in SQLHelper

J

John Dow

I have a IIS hosted WCF Service which uses SqlHelper class from DAAB version
2.0 in the data layer

Once in a while, it throws exception at this line:

Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader()
Type: System.Runtime.InteropServices.COMException
Message: The handle is invalid. (Exception from HRESULT: 0x80070006
(E_HANDLE))

In the IIS server (6.0), the application pool gets recycled. And the event
log show following error message:

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/671226/Root/WCFMerchant

Process ID: 5960

Exception: System.Threading.SemaphoreFullException

Message: Adding the given count to the semaphore would cause it to exceed
its maximum count.

StackTrace: at System.Threading.Semaphore.Release(Int32 releaseCount)
at System.Data.ProviderBase.DbConnectionPool.CleanupCallback(Object
state)
at System.Threading._TimerCallback.TimerCallback_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)

Anyone has any idea why this error occurs? Is there any problem to use the
SQLHelper class which mostly in static methods from WCF service
(multithreaded)? If that is the case, any solution to fix it without
greatly reconstruct my project ?
 
S

sloan

Wasn't the DAAB written for the 1.1 framework...and since you're using WCF,
you're using at least the 3.0 (or 3.5) framework?

.......................

I would switch to the EnterpriseLibrary.Data library instead of the DAAB
2.0.
EnterpriseLibrary 3.1 or 4.0 depending on where you're at now.


My 2.0 version of my sample code
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry
and it uses the EnterpriseLibrary (3.1)

My 1.1 version of my business object code
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!139.entry
using the DAAB 2.0.

So you have an almost direct translation of the 2 libraries and their
slightly different syntax.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top