I have the following code that uses transactionScope
using (TransactionScope scope = new TransactionScope())
{
MamConfiguration oldConfiguration;
int oldTestId;
using (mamdbEntities = new MaMDBEntities())
{
oldConfiguration = GetOldTestId(item.TestID);
if (oldConfiguration == null)
{
...
ConvertToEfAndSave(item, oldTestId, oldConfiguration.CreatedDate);
if(!item.UserMessage.IsErrorOccur)
{
scope.Complete();
}
}
The transaction fails with the following error:
17 Feb 2013 09:34:01,359||[15]||ERROR||MamInfrastructure.Logger.Log4NetLogger||Faild Update configuration to DB
System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. ---> System.Runtime.InteropServices.COMException: The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B)
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.EnlistNonNull(Transaction tx)
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()
at Conduit.Mam.MaMDBEntityFramework.MamConfigurationBlDal.DeleteOldConfigurationTestId(Int32 testId) in d:\Builds\TFS\10\281\Sources\Server\MamAdmin\Dev\Admin 1.5\MaMDBEntityFramework\MamConfigurationBlDal.cs:line 135
at Conduit.Mam.MaMDBEntityFramework.MamConfigurationBlDal.Save(MamConfigurationBL item) in d:\Builds\TFS\10\281\Sources\Server\MamAdmin\Dev\Admin 1.5\MaMDBEntityFramework\MamConfigurationBlDal.cs:line 77
at Conduit.Mam.BL.SaveTestToDB.UpdateConfiguration(ABTest configuration, Boolean isProduction, Int32 testID) in d:\Builds\TFS\10\281\Sources\Server\MamAdmin\Dev\Admin 1.5\MaMBL\SaveTestToDB.cs:line 70
at Conduit.Mam.Admin.Controllers.HomeController.Update(String expression, Boolean isProductionMode, Int32 testId) in d:\Builds\TFS\10\281\Sources\Server\MamAdmin\Dev\Admin 1.5\MAMAdmin\Controllers\HomeController.cs:line 114
How can it be a MSDTC
? My transaction isn't distributed
User contributions licensed under CC BY-SA 3.0