Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The transaction manager has disabled its support for remote/network transactions

I'm using SQL Server and ASP.NET. I have the following function:

Using js = daoFactory.CreateJoinScope()
    Using tran = New Transactions.TransactionScope()
        '...
        tran.Complete()
    End Using
End Using

However, the following exception is thrown:

The transaction manager has disabled its support for remote/network transactions.

Description of JoinScope:

Public Class JoinScope
    Implements IJoinScope
    Implements IDisposable
    '...
End Class

I have worked this way in another application with the same environment without a problem, but here I have this problem. What could I do to fix the issue?

like image 697
Lajos Arpad Avatar asked Apr 12 '12 19:04

Lajos Arpad


People also ask

How do I set local DTC properties?

Expand the Distributed Transaction Coordinator node, and then select the Local DTC node. In the window's toolbar, select (the Properties button). Tip: Alternatively, you can right-click the Local DTC node, and then select Properties. The Local DTC Properties window appears, displaying the Tracing section.

What is Msdtc service?

The Microsoft Distributed Transaction Coordinator (MSDTC) service is a component of modern versions of Microsoft Windows that is responsible for coordinating transactions that span multiple resource managers, such as databases, message queues, and file systems.


Video Answer


3 Answers

Make sure that the "Distributed Transaction Coordinator" Service is running on both database and client. Also make sure you check "Network DTC Access", "Allow Remote Client", "Allow Inbound/Outbound" and "Enable TIP".

To enable Network DTC Access for MS DTC transactions

  1. Open the Component Services snap-in.

    To open Component Services, click Start. In the search box, type dcomcnfg, and then press ENTER.

  2. Expand the console tree to locate the DTC (for example, Local DTC) for which you want to enable Network MS DTC Access.

  3. On the Action menu, click Properties.

  4. Click the Security tab and make the following changes: In Security Settings, select the Network DTC Access check box.

    In Transaction Manager Communication, select the Allow Inbound and Allow Outbound check boxes.

like image 107
Magnus Avatar answered Oct 08 '22 19:10

Magnus


I had a store procedure that call another store Procedure in "linked server".when I execute it in ssms it was ok,but when I call it in application(By Entity Framework),I got this error. This article helped me and I used this script:

EXEC sp_serveroption @server = 'LinkedServer IP or Name',@optname = 'remote proc transaction promotion', @optvalue = 'false' ;

for more detail look at this: Linked server : The partner transaction manager has disabled its support for remote/network transactions

like image 44
Amirhossein Yari Avatar answered Oct 08 '22 18:10

Amirhossein Yari


In my scenario, the exception was being thrown because I was trying to create a new connection instance within a TransactionScope on an already existing connection:

Example:

void someFunction()
{
    using (var db = new DBContext(GetConnectionString()))
    {
        using (var transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
        {
            someOtherFunction(); // This function opens a new connection within this transaction, causing the exception.
        }
    }
}

void someOtherFunction()
{
    using (var db = new DBContext(GetConnectionString()))
    {
        db.Whatever // <- Exception.
    }
}
like image 13
Daniel Minnaar Avatar answered Oct 08 '22 19:10

Daniel Minnaar