服務合約標記 [TransactionFlow(TransactionFlowOption.Mandatory)],但端點繫結未啟用交易流,拋出:「At least one operation... Mandatory but the channel's binding 'NetTcpBinding' is not configured with a TransactionFlowBindingElement」。
<bindings>
<netTcpBinding>
<binding name="netTcpBindingTcp" transactionFlow="true" transactionProtocol="WSAtomicTransactionOctober2004">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<endpoint address="net.tcp://localhost:9002/WCFServiceTransaction2"
binding="netTcpBinding"
bindingConfiguration="netTcpBindingTcp"
contract="WCFService.IWCFServiceTransaction2" />
關鍵:transactionFlow="true" 啟用 TransactionFlowBindingElement,transactionProtocol 指定協定版本。程式碼建立繫結同樣需設定 TransactionFlowBindingElement。