views:

1602

answers:

2

I received the following error when I tried to run a C# WinForms application on a Windows Server 2003 Standard Edition SP1 machine that was connecting to a SQL server 2000, converting the data in the WinForms app and inserting the converted into a SQL server 2005 application. I am connecting to each database using SSPI.

The code was contained within a TransactionScope block:

System.TimeSpan TransactionTimeOut = new TimeSpan(0, 40, 0);

    using(TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew, TransactionTimeOut))
    {
        try
        {
            //meat of transaction...
        }
        catch(Exception ex)
        {
            throw ex;
        }

        Scope.Complete();
    }

Error Messages:

Exception: The transaction has already been implicitly or explicitly committed or aborted.

Inner Exception: The transaction has already been implicitly or explicitly committed or aborted (Exception from HRESULT: 0x8004D00E)

Any one know what might be causing this issue?

A: 

How long is this process taking? If you hit your timeout (unlikely with a 40 minute timeout, but still possible), you could receive that error message.

Otherwise, are you receiving the exception? What is occurring before the exception is thrown?

Reed Copsey
I am only processing about 6500 records, so I am definitely not hitting my timeout threshold. This is the only exception I get when I try to run the process
Michael Kniskern
I'd guess Mitch Wheat might be on the right track, then...
Reed Copsey
In order to try his solution, I need to get permission to make the change on the server.
Michael Kniskern
+4  A: 

Check that the DTC is started on the machine where your code is running. Since you are using 2 connections in the transactionscope, the transaction will be promoted to a DTC based transaction.

Also, check that the security is configured correctly (check this by allowing anonymous participation in the DTC transaction), and that your firewall is allowing the DTC through it.

Check out this forum FAQ: Distributed Transaction Coordinator(MSDTC) and Transaction FAQ

[Related to this SO question: Distributed Transaction Coordinator]

Mitch Wheat
DTC is set to Mutual Authenication on the server, unfornuatly I have to fill out a change request to adjust any of the settings on the server because it is in the production environment
Michael Kniskern
I had to set the MSDTC Transaction Manager Communication setting from "Mutual Authentication Required" to "No Authentication Required"...thanks for the info.
Michael Kniskern
Where/how did you make that change?
Neil Barnwell
Control Panel->Administratve Tools->Component Services. Expand Component Services->Computers->Right click on My Computer and select properties. Select the MSDTC tab, click the Security Configuration and it is under the Transaction Manager Communication section.
Michael Kniskern