0

The code shown here worked fine without any error on quality site, but the same code is causing an error

The Transaction has aborted

on the production site.

The error occurs on dispose of the scope. Please help me resolve this issue.

I did check:

  • Network DTC Setting on server and database server
  • Both sites (Quality and Production) are on same Server (Server A) and database also on same server (Server B)

Code:

option.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
option.Timeout = TimeSpan.FromMinutes(5);

using (_objTransactionScope = new TransactionScope(TransactionScopeOption.Required, option))
{
    //..Open Connection
    //..Process the Document
    //..Update Additional information in Table2 about document(Delete/Insert)   
    //..Update Location Information in Table3 about document(Delete/Insert)
    //..Delete the Document in Table4 in Differant Database on Differant Server(WCF Service)
    //..Update the Checksum of the Document and Metadata in Table1
    //..Delete Lock Entry From Table5   
    //..Close Connection
    //..Commit Transaction Scope
}
5
  • The exception is self-explanatory - you need to decide how to deal with it. Commented Nov 14, 2021 at 15:36
  • Welcome to Stack Overflow. Please take the tour to learn how Stack Overflow works and read How to Ask on how to improve the quality of your question. Then edit your question to include your source code as a working minimal reproducible example, which can be compiled and tested by others. Commented Nov 14, 2021 at 15:37
  • there is no any error... Commented Nov 14, 2021 at 15:38
  • 1
    Shouldn't this bit //..Close Connection //..Commit Transaction Scope be other way around? Commented Nov 14, 2021 at 18:14
  • If your comments within the using block are correct, I think you want to commit before you close the connection. Commented Nov 15, 2021 at 3:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.