2

I am using Azure Web App to host the site

Used asp.net using vb.net and sql server hosted on an azure vm

A strange error "the promote method returned an invalid value for the distributed transaction" and very little information on web.

I am using it in transaction scope

where MainMethod calls MethodA & MethodB wrapped inside a transactionscope and each methods are further using transactionscope individually.

I don't get error running locally.

I get this error only in Azure Web App services.

Any suggestions highly welcome.

Prasanth
  • 173
  • 1
  • 10

1 Answers1

9

The error indicates that your transaction is getting promoted to a distributed transaction. Distributed Transactions rely on MSDTC which uses DCOM protocol internally and DCOM will not work in Azure Webapps. A LTM (Lightweight transaction) gets promoted to a distributed transaction if you open multiple connections (Connection.open) within the same TransactionScope.

You can either ensure that only a single sqlconnection is opened in a transactionscope, or try changing your code to use SqlTransactions instead of TransactionScope or distributed transactions. In some articles it is also mentioned that if you use ENLIST=FALSE in connection string then elevation to MSDTC wont happen but not sure if that is a viable solution if multiple connections are opened in same transaction scope.

Also check these out

Community
  • 1
  • 1
Puneet Gupta
  • 2,237
  • 13
  • 17