MessageQueueTransaction.Commit 方法


認可一個暫止的內部交易。Commits a pending internal transaction.

 void Commit();
public void Commit ();
member this.Commit : unit -> unit
Public Sub Commit ()


您嘗試認可的交易尚未啟動。The transaction you are trying to commit has not started.

發生內部訊息佇列錯誤。An internal Message Queuing error occurs.


Commit在呼叫Begin時, 標示成功完成處理的作業。Commit marks the successful completion of processing begun at a call to Begin. 如果在呼叫BeginCommit呼叫之間發生例外狀況, 則會回復整個交易。If an exception occurs between the call the Begin and the call to Commit, the entire transaction is rolled back. 這包括呼叫Begin之後傳送或接收的所有訊息。This includes all messages sent or received after the call to Begin.

一般來說, 一個Begin會呼叫Try...Catch例外狀況處理區塊內的Commit , 將Try呼叫放Abort入子句中, 並在Catch子句中呼叫。Typically, one makes a call to Begin within a Try...Catch exception-handling block, putting a call to Commit in the Try clause, and a call to Abort in the Catch clause.