情境:在WCF 的通訊中 使用 WSAtomicTransaction11 來管理Oracle的分散式交易,有一篇外文文檔參考
MakeCert.exe wsatui.dll
下載(包含64位,32位)
1. 添加信任認證
使用Windows SDKs的工具MakeCert.exe,為MachineA和MachineB產生X.509認證(分別稱為CertA和CertB)
makecert -ss My –sr LocalMachine –pe –r –sky
exchange–n CN=MachineA
這裡需要注意的是"CN=MachineA"中的伺服器名。
2、在MachineA中,從認證中的電腦帳號Trusted
Root Certificate Authority Node區到處認證CertA,並匯入到Personal 地區(匯出時需要同時匯出私密金鑰)。在MachineB也做同樣的操作。
4、在MachineA將CertA的公開金鑰匯出到檔案CertA.cer,並匯入到MachineB的電腦帳號中的Trusted Root Certificate Authority Node地區和Personal地區。同樣將CertB的公開金鑰匯出到MachineA的電腦帳號中的Trusted
Root Certificate Authority Node地區和Personal地區。
將MachinaA的私密金鑰匯入到MachinaA
的Trusted Root Certificate Authority Node地區
將MachinaB的私密金鑰匯入到MachinaB 的Trusted
Root Certificate Authority Node地區
5、配置MSDTC,啟用WS-AT協議。
註冊程式集wsatui.dll(可以在Windows SDKs的bin目錄找到該檔案,預設安裝目錄是C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin),執行命令:
regasm /codebase C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\wsatui.dll
Note:The wsatui.dll has to match the operation system bit version, e.g. x86 operation system should register the x86version wsatui.dll.
6、執行了上面的操作後,開啟MSDTC的配置,就會看到多了一個WS-AT的Tab。在裡面配置一下相關的參數:
(1)選擇啟用WS-AT
(2)設定Https連接埠,預設是443
(3)設定Endpoint Certificate,對於MachineA,選擇CertA,對於MachineB,選擇CertB
(4)設定Authorized certificates,對於MachineA,選擇CertB,對於MachineA,選擇CertA(如果有多台伺服器參與分散式交易,可以選擇多個cert)
到此為止已經配置好啟用WS-AT協議了,接下來就可以寫WCF程式來跑跑WS-AT協議了。