0
Answer

.Net Transaction Scope Error -The MSDTC transaction manager

senthil kumar

senthil kumar

11y
2.4k
1
The below error is throwing while running multiple transaction in single transaction scope
 
Error - "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)"

I am using the below sample code to Save the Card details,

public Int64 SaveDetails(CardDO _Card)
{
try
{
Int64 PayerId = 0;
// Begin the transcation and call the add method
var transactionScopeOptions = new TransactionOptions();
transactionScopeOptions.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
transactionScopeOptions.Timeout = TimeSpan.MaxValue;
using (TransactionScope OuterScope = new TransactionScope(TransactionScopeOption.Required, transactionScopeOptions))

using (TransactionScope InnerScope1 = new TransactionScope())
{
PayerId = SavePayer(_Card.PayerDetails, _Card.ROW_STATE);
InnerScope1.Complete();
}
_Card.PAYER_ID = PayerId;
using (TransactionScope InnerScope2 = new TransactionScope())
{
_Card.PAYER_ID = PayerId;
if (_Card.ROW_STATE == RowState.Created)
{
_Card._CARD_ID = SaveCardDetails(_Card);
}
else if (_Card.ROW_STATE == RowState.Modified)
{
int result = UpdateCardDetails(_Card);
if (result <= 0)
{
throw new Exception("Error : card updation failed.");
}
}
InnerScope2.Complete();
}
using (TransactionScope InnerScope3 = new TransactionScope())
{
SaveCardLabour(_Card.CardLabourList, _Card.ROW_STATE, _Card._CARD_ID);
InnerScope3.Complete();
}
OuterScope.Complete();
}
// DALHelper.Instance.Commit(); // Commit the Transcation
return _Card._CARD_ID;
}
catch (TransactionAbortedException ex)
{
throw new Exception(" Card Save Aborted: " + ex.Message);
}
catch (Exception ex)
{
throw ex;
}
}


The first DB call "SavePayer()" is working perfect; when it enter the Second DB call "SaveCardDetails", transcation getting failed and am getting the below error,


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)
 
If you have any idea on this issue, help me out..
Next Recommended Forum