DbConnection池错误(Microsoft.Win32.SafeNativeMethods.ReleaseSemaphore)

时间:2011-01-31 20:50:40

标签: c# .net sql-server vb.net

我的VB.NET代码中出现此错误。任何人都有关于它可能是什么或如何排除故障的想法。我正在使用SQL Server 2008,并且此错误不会始终如一。看起来它完全是随机发生的,似乎并非源于我的代码:

MESSAGE: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Microsoft.Win32.SafeNativeMethods.ReleaseSemaphore(SafeWaitHandle handle, Int32 releaseCount, Int32& previousCount)
   at System.Threading.Semaphore.Release(Int32 releaseCount)
   at System.Data.ProviderBase.DbConnectionPool.PutNewObject(DbConnectionInternal obj)
   at System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInternal obj)
   at System.Data.ProviderBase.DbConnectionPool.ReclaimEmancipatedObjects()
   at System.Data.ProviderBase.DbConnectionPool.PoolCreateRequest(Object state)
   at System.Threading._ThreadPoolWaitCallback.WaitCallback_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._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

2 个答案:

答案 0 :(得分:1)

似乎问题是处理对象或引用已更改(内存指针)。你可以发布任何代码吗?

http://msdn.microsoft.com/en-us/library/ms685071(v=vs.85).aspx

答案 1 :(得分:0)

我曾经读过一篇博客,说过这个人遇到了类似的问题。他们已从32位升级到64位并且没有更改其构建属性目标平台。你可以从那里开始。

HTH