none
Transaction unexpectedly requires DTC on Windows Server 2008 (which causes problems for test 3.9) RRS feed

  • Question

  •  

    We're having problems running our application in a Highly Secure mode because of something that seems to be a changed behavior in Windows Server 2008. I have tried opening a ticket with support to help us resolve this problem, but they're not able to help because it is not released yet. I have also posted this question in the ADO.NET newsgroup, but failed to get help there as well. Can we find out through this channel here what is causing this problem?

     

    I have been able to reproduce our problem using a very small console application. The code you'll find below. It uses explicit transactions to execute two sqlcommands against a local sql server 2005 database each within its own transaction using the same sqlconnection. This works perfectly on Windows Server 2003, Windows XP and on Windows Vista without DTC (Distributed Transaction Coordinator) running, but on a 64-bit Windows Server 2008 RC1 it throws a SqlException on the second call to EnlistTransaction if the DTC service is not running. For some reason, the second call to EnlistTransaction promotes to a Distributed Transaction on a 64-bit Windows Server 2008 RC1 although it shouldn't need to because the first transaction has already been committed.

     

    class Program
    {
      static void Main(string[] args)
      {
        SqlConnectionStringBuilder oBuilder = new SqlConnectionStringBuilder();
        oBuilder.InitialCatalog = "database";
        oBuilder.DataSource = "localhost";
        oBuilder.IntegratedSecurity = true;
        SqlConnection oConnection = new SqlConnection(oBuilder.ToString());
        oConnection.Open();

     

        Console.WriteLine("Transaction 1...");
        CommittableTransaction oTransaction = new CommittableTransaction();
        oConnection.EnlistTransaction(oTransaction);
        SqlCommand oCommand = new SqlCommand("UPDATE tblUSERS SET Tag = '<root/>' WHERE Name = 'Administrator'", oConnection);
        oCommand.ExecuteNonQuery();
        oTransaction.Commit();
        oTransaction.Dispose();

     

        Console.WriteLine("Transaction 2...");
        oTransaction = new CommittableTransaction();
        oConnection.EnlistTransaction(oTransaction);
        oCommand = new SqlCommand("UPDATE tblUSERS SET Tag = '<root5/>' WHERE Name = 'Administrator'", oConnection);
        oCommand.ExecuteNonQuery();
        oTransaction.Commit();
        oTransaction.Dispose();

     

        Console.WriteLine("Closing...");
        oConnection.Close();
      }
    }

    Tuesday, January 8, 2008 11:21 AM

Answers

  •  

    Hi,

     

    Sorry for the lateness of my reply. I have just tried on the RTM version of Windows Server 2008 and it looks like the problem no longer occurs there. It must have been a bug in the build that I was using I suppose.

     

    Thanks for your help,

    Michael

    Saturday, February 9, 2008 5:03 PM

All replies

  • Hi Michael,

     

    I'll check with your sample code and update you observations.

     

    Thanks.

     

    Wednesday, January 9, 2008 6:11 PM
  • Hi Michael,

     

    Not sure if I missed anything, but I couln't reproduce your issue in a WS2k8 64 bit OS. The transactions didn't throw any exception and completed successfully. I'm using build 6001 for the Enterprise version. Also I could not find DTC running.

     

    Can you please provide any steps to repro.

     

    Thanks.

    Thursday, January 10, 2008 5:07 PM
  • Hi,

     

    We have been able to reproduce on 5 different Windows Server 2008 machines (they're all machines that we're using for certification testing). We have tried on single core and on mult-core servers. One or two are installed on actual servers, the other are running within VMWare.

     

    Here's how we initially found the problem:

    1. Installed Windows Server 2008 Enterprise Edition 64-bit  (Build 6001: SP1, v275) 
    2. Installed Sql Server 2005 64-bit Enterprise Edition (Database Engine and Workstation components)
    3. Installed Sql Server 2005 SP2
    4. Compiled the source code using Visual Studio 2005 (.NET 2.0) to an executable with CPU-type Any Platform
    5. Started the Windows Server 2008 Security Configuration Wizard and created a new High Security policy as described in test 3.9 of the Application Test Framework for Windows Server 2008.
    6. Ran the console application and noticed that it crashed on the second EnlistTransaction.
    7. Rolled back the policy we just applied and ran the console again. It doesn't crash now.
    8. Manually stopped the DTC service and ran the console again. It crashes again on the second EnlistTransaction.

    I hope this gives you sufficient information to reproduce this problem.

     

    Regards,

    Michael

    Friday, January 11, 2008 3:17 PM
  • Hi Michael,

     

    I'll again go through the steps to see if I can reproduce. However, it seems the only difference I have is that I have SQL 2008 installed along with SQL 2005 in that box. Have you tried with SQL 2008 installed?

     

    I'll update you with my observations soon.

     

    Thanks.

     

    Tuesday, January 15, 2008 2:11 PM
  • Hi Michael,

     

    Sorry for the delay in reply. Wish your issue is sorted. However, I still could not reproduce the error in a fresh system with SQL 2005.

     

    However for me the version was Build 6001: SP1, v667 as compared to v275 that you mentioned. So, I'd suggest you to test with an updated version if available.

     

    Hope this helps.

     

    Good luck!

    Tuesday, January 29, 2008 6:43 PM
  •  

    Hi,

     

    Sorry for the lateness of my reply. I have just tried on the RTM version of Windows Server 2008 and it looks like the problem no longer occurs there. It must have been a bug in the build that I was using I suppose.

     

    Thanks for your help,

    Michael

    Saturday, February 9, 2008 5:03 PM