title: TransactionScope Allows Partial Update Even Though Second Service Errors
body: <p>I have had a good trawl through related questions and implemented suggestions found, but I still have a problem with .NET TransactionScope.</p>
  
  <p>I am calling two WCF services from a method and even though the second service errors (deliberately in this case) the first service doesn't roll back. I have created a simple test application to demonstrate the problem.</p>
  
  <p>Here is the calling method:</p>
  
  <pre><code>private void TryATransaction()
  {
      ServiceReference1.IService1 service = new ServiceReference1.Service1Client();
      ServiceReference2.IService1 service2 = new ServiceReference2.Service1Client();
  
      using (TransactionScope scope = new TransactionScope())
      {
          service.TestMethod("one");
          service2.UpdateSomethingElse("two");
  
          scope.Complete();
      }
  }
  </code></pre>
  
  <p>The first service looks like this (connections made anonymous):</p>
  
  <pre><code>public bool TestMethod(string anything)
  {
          using (TransactionScope scope = new TransactionScope())
          {
  
              // connect to a db
              using (SqlConnection connection = new SqlConnection("Data Source=DATASOURCE;Initial Catalog=DATABASE;Integrated Security=SSPI;Transaction Binding=Explicit Unbind;"))
              {
  
                  connection.Open();
                  // save something
                  SqlCommand command1 = new SqlCommand("EXECUTE [DATABASE].[dbo].[uspUpdateCustomer] 3, 'test@test.com', 1, null", connection);
                  command1.ExecuteNonQuery();
                  connection.Close();
  
              }
  
              scope.Complete();
          }
  
      return true;
  }
  </code></pre>
  
  <p>And the second service is identical to the first service, except that it updates a different field in the database.</p>
  
  <p>1) If I run this without forcing an error, it updates all fields fine.</p>
  
  <p>2) When I run this and force an error in the second service, the update from the first service gets committed to the database, whereas the second service gets rolled back (the error is AFTER the ExecuteNonQuery statement).</p>
  
  <p>This example code essentially follows the examples found here:
  <a href="http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx</a></p>
  
  <p>And I added Explicit Unbind, which was recommended in other related questions.</p>
  
  <p>Your suggestions are very welcome - and I'm happy to add more information if it's required.</p>
  
  <p><strong>Extra Information</strong></p>
  
  <p>The distributed identifier seems to be 00000000-0000-0000-0000-000000000000 at all times - I don't know if this is a clue.</p>
  
  <p>Here is the dubug output of distributed id and local id (in that order)</p>
  
  <blockquote>
    <p>Current transaction is
    00000000-0000-0000-0000-000000000000 -
    f6446876-496d-488c-a21c-1e4c4295d50c:8</p>
    
    <p>Current transaction is
    00000000-0000-0000-0000-000000000000 -
    7edd5ba3-7f5a-42af-b9ca-37b3862c26a7:2</p>
    
    <p>Current transaction is
    00000000-0000-0000-0000-000000000000 -
    6fa0e3f7-b655-40ad-8bdd-f0670de79a49:2</p>
  </blockquote>
  
  <p>The transaction is being started via the code behind an aspx page in my example app.</p>