2012-11-29 131 views
1

我遇到了在我的應用程序中設置事務的問題。當我進行輕量交易它的工作原理:嵌套事務 - MSDTC

using (TransactionScope tx = new TransactionScope()) 
{ 
    // Connect to Server 1 in a transaction 

    tx.Complete() 
} 

當我做一個嵌套事務,它失敗:

using (TransactionScope tx = new TransactionScope()) 
{ 
    // Connect to Server 1 in a transaction 

    using (TransactionScope tx2 = new TransactionScope()) 
    { 
     // Connect to Server 2 in a transaction 

     tx2.Complete() 
    } 

    tx.Complete() 
} 

我得到的錯誤是:

The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B) 

當我在服務器上運行相同的確切代碼,它的工作原理。我的電腦上運行/配置了MSDTC(設置與服務器相同)。

我們的網絡部門說他們在防火牆上看不到阻塞的流量。

我可以將DTC從我的電腦Ping到服務器,但不能從服務器回來。

任何想法?我認爲這是一個網絡問題,但需要一些幫助。

+0

像往常一樣,開發人員需要解決一些其他dep問題:)嘗試向他們顯示此鏈接:http://technet.microsoft.com/en-us/library/cc725913(WS.10).aspx –

回答

0

我可以從我的電腦到服務器的DTC Ping,但不能從服務器回來。

這似乎是原因。 MSDTC要求兩臺機器都可以通過NetBios名稱互相看到。您應該可以通過'nbtstat -a xxx.xxx.xxx.xxx'來解析IP來命名這兩種方式。

還必須在兩臺機器上打開135端口。