Programing

트랜잭션 관리자가 원격 / 네트워크 트랜잭션에 대한 지원을 비활성화했습니다.

lottogame 2020. 10. 10. 09:30
반응형

트랜잭션 관리자가 원격 / 네트워크 트랜잭션에 대한 지원을 비활성화했습니다.


SQL Server와 ASP.NET을 사용하고 있습니다. 다음과 같은 기능이 있습니다.

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

그러나 ' 트랜잭션 관리자가 원격 / 네트워크 트랜잭션에 대한 지원을 비활성화했습니다. '이 던져집니다.

JoinScope에 대한 설명 :

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

나는 문제없이 동일한 환경의 다른 응용 프로그램에서 이런 식으로 작업했지만 여기 에이 문제가 있습니다. 문제를 해결하려면 어떻게해야합니까?


"Distributed Transaction Coordinator"서비스가 데이터베이스와 클라이언트 모두에서 실행되고 있는지 확인하십시오. 또한 "네트워크 DTC 액세스", "원격 클라이언트 허용", "인바운드 / 아웃 바운드 허용"및 "TIP 사용"을 선택했는지 확인하십시오.

MS DTC 트랜잭션에 대해 네트워크 DTC 액세스를 활성화하려면

  1. 구성 요소 서비스 스냅인을 엽니 다.

    구성 요소 서비스를 열려면 시작을 클릭합니다. 검색 상자에 dcomcnfg를 입력 한 다음 Enter 키를 누릅니다.

  2. 콘솔 트리를 확장하여 네트워크 MS DTC 액세스를 활성화 할 DTC (예 : 로컬 DTC)를 찾습니다.

  3. 동작 메뉴에서 속성을 클릭합니다.

  4. 보안 탭을 클릭하고 다음과 같이 변경합니다. 보안 설정에서 네트워크 DTC 액세스 확인란을 선택합니다.

    트랜잭션 관리자 통신에서 인바운드 허용 및 아웃 바운드 허용 확인란을 선택합니다.


나는이 문제를 간헐적으로 받고 있었고, 여기에있는 지침과 다른 곳에서 매우 유사한 지침을 따랐습니다. 모두 올바르게 구성되었습니다.

이 페이지 : http://sysadminwebsite.wordpress.com/2012/05/29/9/ 문제를 찾는 데 도움이되었습니다.

기본적으로 두 서버에서 MSDTC에 대해 중복 CID가 있습니다. HKEY_CLASSES_ROOT \ CID

참조 : http://msdn.microsoft.com/en-us/library/aa561924.aspx 섹션 MSDTC에 고유 한 CID 값이 할당되었는지 확인

저는 가상 서버로 작업하고 있으며 서버 팀은 모든 서버에 동일한 이미지를 사용하는 것을 좋아합니다. 간단한 수정이며 다시 시작할 필요가 없습니다. 그러나 DTC 서비스는 자동 시작으로 설정해야했고 다시 설치 한 후에 시작해야했습니다.


"연결된 서버"에서 다른 저장 프로 시저를 호출하는 저장 프로 시저가 있습니다. ssms에서 실행하면 괜찮 았지만 응용 프로그램 (Entity Framework에서)에서 호출 할 때이 오류가 발생했습니다. 이 기사는 저를 도왔고 다음 스크립트를 사용했습니다.

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

자세한 내용은 다음을 참조하십시오. 연결된 서버 : 파트너 트랜잭션 관리자가 원격 / 네트워크 트랜잭션에 대한 지원을 비활성화했습니다.


내 시나리오에서는 이미 기존 연결의 TransactionScope 내에서 새 연결 인스턴스를 만들려고했기 때문에 예외가 발생했습니다.

예:

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.
    }
}

에서 코멘트 대답은 "당신이 트랜잭션 내부의 모든 데이터베이스 호출에 대해 동일한 열린 연결을 사용할 수 있는지 확인 - 매그너스."

사용자는 트랜잭션에서 작업했던 데이터와 별도의 db에 저장됩니다. 사용자를 얻기 위해 db 연결을 열면이 오류가 발생했습니다. 다른 db 연결 및 사용자 조회를 트랜잭션 범위 외부로 이동하면 오류가 수정되었습니다.


I post the below solution here because after some searching this is where I landed, so other may too. I was trying to use EF 6 to call a stored procedure, but had a similar error because the stored procedure had a linked server being utilized.

The operation could not be performed because OLE DB provider _ for linked server _ was unable to begin a distributed transaction

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

Jumping over to SQL Client did fix my issue, which also confirmed for me that it was an EF thing.

EF model generated method based attempt:

db.SomeStoredProcedure();

ExecuteSqlCommand based attempt:

db.Database.ExecuteSqlCommand("exec [SomeDB].[dbo].[SomeStoredProcedure]");

With:

var connectionString = db.Database.Connection.ConnectionString;
var connection = new System.Data.SqlClient.SqlConnection(connectionString);    
var cmd = connection.CreateCommand();
cmd.CommandText = "exec [SomeDB].[dbo].[SomeStoredProcedure]";

connection.Open();
var result = cmd.ExecuteNonQuery();

That code can be shortened, but I think that version is slightly more convenient for debugging and stepping through.

I don't believe that Sql Client is necessarily a preferred choice, but I felt this was at least worth sharing if anyone else having similar problems gets landed here by google.

The above Code is C#, but the concept of trying to switch over to Sql Client still applies. At the very least it will be diagnostic to attempt to do so.


In case others have the same issue:

I had a similar error happening. turned out I was wrapping several SQL statements in a transactions, where one of them executed on a linked server (Merge statement in an EXEC(...) AT Server statement). I resolved the issue by opening a separate connection to the linked server, encapsulating that statement in a try...catch then abort the transaction on the original connection in case the catch is tripped.


I had the same error message. For me changing pooling=False to ;pooling=true;Max Pool Size=200 in the connection string fixed the problem.


I was having this issue with a linked server in SSMS while trying to create a stored procedure.

On the linked server, I changed the server option "Enable Promotion on Distributed Transaction" to False.

Screenshot of Server Options

참고URL : https://stackoverflow.com/questions/10130767/the-transaction-manager-has-disabled-its-support-for-remote-network-transactions

반응형