.NET新推出的TransactionScope提供了更簡便封裝Transaction的寫法。今天試著從我的Windows 2003 用TransactionScope包裝一段對SQL 2005 @ Windows 2000的程式碼時,卻連闖三關才達陣!

首先,我收到這個錯誤:

System.Runtime.InteropServices.COMException (0x8004D024): The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.

後來發現是因為Windows 2003(DB的Client端)的"Enable network DTC access"安裝選項沒開啟(以往都只注意到SQL 2005 Server上要啟用這個功能,今天才確認了Client端也要設定),依在Windows 2003上啟用MSDTC的SOP處理完畢,卻忘了開防火牆給MSDTC.EXE,結果得到以下錯誤:

Error HRESULT E_FAIL has been returned from a call to a COM component.
Communication with the underlying transaction manager has failed.

在防火牆上開放MSDTC.EXE通行後,卻還是同樣的訊息。這才想起: "兩台機器分屬不同網域!"。用了之前的跨網域DTC設定技巧,連闖三關,總算才測通。

今天這篇TIPS算是給大家來個MSDTC設定與錯誤排除總複習吧!


Comments

Be the first to post a comment

Post a comment


49 + 32 =