使用的TransactionScope和MS DTC偶尔System.ArgumentNullException [英] Occasional System.ArgumentNullException using TransactionScope and MS DTC
问题描述
我occasionaly把我们的生产服务器上此异常:
I'm occasionaly getting this exception on our production server:
System.ArgumentNullException: Value cannot be null.
at System.Threading.Monitor.Enter(Object obj)
at System.Data.ProviderBase.DbConnectionPool.TransactedConnectionPool.TransactionEnded(Transaction transaction, DbConnectionInternal transactedObject)
at System.Data.SqlClient.SqlDelegatedTransaction.SinglePhaseCommit(SinglePhaseEnlistment enlistment)
at System.Transactions.TransactionStateDelegatedCommitting.EnterState(InternalTransaction tx)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
//... continues here with references to my DAL code
什么是此异常情况发生的原因是什么?
我已经做了这一点,但没有conrete成功但一些研究。我也看过这个问题在这里:
I have already did some research on this but with no conrete success yet. I also read this questions here:
- <一个href="http://stackoverflow.com/questions/12427591/intermittent-system-argumentnullexception-using-transactionscope">Intermittent System.ArgumentNullException使用的TransactionScope
- <一个href="http://stackoverflow.com/questions/1690892/transactionscope-automatically-escalating-to-msdtc-on-some-machines">TransactionScope自动升级到MSDTC某些机器上?
- Intermittent System.ArgumentNullException using TransactionScope
- TransactionScope automatically escalating to MSDTC on some machines?
现在我知道,如果我能避免升级我的交易DTC 我想摆脱这个问题。 但是,如果我不能?我有多个数据库进行更新或在一个事务中读取,所以我不得不使用DTC。我在平时的工作原理以及操作ocassionaly收到此错误。
And now I know that if I could avoid escalating my transactions to DTC I would get rid of this problem. But what if I could not? I have multiple databases to update or read from in one transaction so I have to use DTC. I'm getting this error ocassionaly on actions that usually works well.
技术背景
- 这是ASP MVC2和LINQ2SQL在.NET 3.5 应用
- 我们有三个虚负载balanacing基于IP地址,每一个IIS7
- 单当前虚拟与SQL Server 2008 - 它是由Web服务器共享
我要指出的是,我没能无论是在自己的计算机(开发服务器+ SQL EX preSS 2008年)和我们的测试机(虚拟单IIS7和SQL Server 2008一起)上重现此异常。
I should point out that I was not able to reproduce this exception on my development machine (development server + SQL express 2008) and on our testing machine (virtual with single IIS7 and SQL server 2008 together) either.
我怀疑我们的生产服务器的配置,有一些线程/处理问题(如两个进程都试图使用相同的连接)。
I'm suspecting our production servers configuration that there is some threading/processing issue (like two processes are trying to use the same connection).
更新
我已经找到另一个链接。据指出,ado.net连接配置错误可能是回来了。但很可惜没有最终没有解决,我发现没有其他人描述类似的问题。
I have found another link. It is stating that ado.net connection dispose bug is probably back. But it is a pity there is no resolution in the end and I have found nobody else describing similar issue.
- <一个href="http://social.msdn.microsoft.com/Forums/nl-BE/adodotnetdataproviders/thread/388a7965-9385-4f5c-a261-1894aa73c16e" rel="nofollow">http://social.msdn.microsoft.com/Forums/nl-BE/adodotnetdataproviders/thread/388a7965-9385-4f5c-a261-1894aa73c16e
推荐答案
据 http://support.microsoft.com/kb/960754 ,有一个问题2.50727。 4016版System.Data.dll中的。
According to http://support.microsoft.com/kb/960754, there is an issue with 2.50727.4016 version of System.Data.dll.
如果你的服务器有此旧版本,我想尝试获取更新的一个来自微软。
If your server has this older version, I would try to get the updated one from Microsoft.
这篇关于使用的TransactionScope和MS DTC偶尔System.ArgumentNullException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!