gpt4 book ai didi

c# - 是否可以在不允许升级到 DTC 的情况下将 .NET 的 TransactionScope 与 Sql Server 2005 一起使用?

转载 作者:行者123 更新时间:2023-11-30 14:43:31 35 4
gpt4 key购买 nike

我正在处理屁股服务器中的一些非常痛苦的事情,我希望他们只使用没有 DTC 的事务(现在这样我可以专注于其他地方)。我在范围内使用多个数据库,所以典型的行为是促进,但我想避免它。如果可能的话,在此模型下,不确定交易的行为是什么?我假设 tx.Complete() 会抛出?

这是因为我得到了这些随机错误(如果你能提供帮助,请随意插话为什么会这样 - 这些是零星的,不是恒定的):

System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. ---> System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.

at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim)

at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)

--- End of inner exception stack trace ---

at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)

at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)

at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)

at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)

at System.Transactions.Transaction.Promote()

at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)

at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)

at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)

at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)

at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)

at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)

at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

最佳答案

不幸的是,我不认为在涉及多个数据库时避免将事务提升为 DTC 事务是不可能的,甚至是使用多个连接对象的单个数据库。

关于c# - 是否可以在不允许升级到 DTC 的情况下将 .NET 的 TransactionScope 与 Sql Server 2005 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1869886/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com