title: WCF basicHttpBinding: Rollback when reply to client fails
body: <p>I am exposing a WCF service through a <code>basicHttpBinding</code> that executes several operations on a database.</p>
  
  <p>I want to guarantee that if the client does not receive the reply the database operations are rolled back (<em>without any transaction flow through WCF</em>).
  E.g. the client calls the "DoX" method which executes on the server but before it is finished the client crashes. The database operations should then be rolled back as soon as the reply can not be send to the client.</p>
  
  <p>Is there any way to do that? Will the <code>[OperationBehavior(TransactionScopeRequired=true)]</code> attribute work in such a manner? Is there a possibility to handle communication errors on the server side?</p>
  
  <p><em><strong>Update 1:</em></strong>
  It seems <code>[OperationBehavior(TransactionScopeRequired=true)]</code> commits the transaction before the reply is send to the client and thus can not be used to perform a rollback if the client does not receive the reply.</p>
  
  <p><em><strong>Update 2:</em></strong>
  To state it clearly again, I do not have the need for the transaction to interact in any way with the client side. The client should neither know of the transaction, have the ability to cancel or commit it, nor should any transaction flow through the binding. The <em>only</em> place I want the transaction to rollback is on the server side if the transport channel can not deliver the message to the receiving client. With the case of TCP/IP this information should be readily available to the server. (No ACK of the TCP packet send back to the client)</p>
  
  <p>So a hypothetical execution flow on the server side (notice the lack of client side) should be:</p>
  
  <pre><code>Receive client request
  
  Start transaction
  
  Execute all logic inside the service operation
  
  Send reply back to client
  
  if (reply.failedToReceive) { transaction.Rollback() } // due to a failing TCP/IP transmission
  </code></pre>