none
The transaction under which this method call was executing was asynchronously aborted. RRS feed

  • Question

  • Hi,

    Client side code:

    //// Below Code specifically used for TxnScope Options
                using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required))
                {
                    dataFromService = proxy.TestTxnScopeOptions();
                    if (Transaction.Current != null)
                    {
                        stringBuilder.Append("Client LocalIdentifier: " + Transaction.Current.TransactionInformation.LocalIdentifier);
                        stringBuilder.Append("\nClient DistributedIdentifier: " + Transaction.Current.TransactionInformation.DistributedIdentifier);
    
                        ////stringBuilder.Append("\nClient Transaction protocol: " + netTcpBinding.TransactionProtocol.ToString());
                    }
                    else
                    {
                        stringBuilder.Append("No transaction in client");
                    }
                    transactionScope.Complete();
                }


    Server side code:

    [OperationBehavior(TransactionScopeRequired = true)]
            public string TestTxnScopeOptions()
            {
                StringBuilder stringBuilder = new StringBuilder();
    
                using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (Transaction.Current != null)
                    {
                        stringBuilder.Append("Service LocalIdentifier (Inside Transaction Scope): " + Transaction.Current.TransactionInformation.LocalIdentifier);
                        stringBuilder.Append("\nService DistributedIdentifier (Inside Transaction Scope): " + Transaction.Current.TransactionInformation.DistributedIdentifier);
                    }
                    else
                    {
                        stringBuilder.Append("No transaction in service");
                    }
                }
                stringBuilder.Append("Service LocalIdentifier(Outside Transaction Scope): " + Transaction.Current.TransactionInformation.LocalIdentifier);
                stringBuilder.Append("\nService DistributedIdentifier(Outside Transaction Scope): " + Transaction.Current.TransactionInformation.DistributedIdentifier);
                return stringBuilder.ToString();
            }

    The server side code executes successfully, however, upon return, it throws the exception " The transaction under which this method call was executing was asynchronously aborted." I understand, there has been threads already for mentioned exception, but none of it explains the actual reason. 

    Any thoughts?

    Thanks!

    Saturday, May 10, 2014 1:46 PM

All replies