Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,
C#
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..
Posted
Updated 15-Nov-19 4:05am
v3
Comments
Sunasara Imdadhusen 5-Jun-13 8:53am    
I have modified question title. Do not make your question title too long. it should be short and understandable

Hi,
in the SavePlayer funtion you have used the transaction. I think it might be possible that the transaction might be getting reference of the main transaction.
or one other condtion when you can face the problem
When you put nested transaction it will actually put a lock on the table.
in case the upper transactino is put lock on the table and after you open another transaction to use that resource you can get this problem.
the code you have pasted is very less. so don't know what your save changes is doing.
but genrally it is not recomanded to use nested transactions.
may be this pointers can help you to solve this problem
 
Share this answer
 
turn off the firewall on your local computer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900