locked
System.ArgumentException: The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope. Parameter name: transactionOptions.IsolationLevel RRS feed

  • Question

  • Hi All,

    I'm facing this error "System.ArgumentException: The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope.
    Parameter name: transactionOptions.IsolationLevel" when calling the serviced component inside TransactionScope with using stmt. code snippet below

    My Service looks:-

    [TransactionTransactionOption.Required, Isolation=TransactionIsolationLevel.ReadCommitted)]
    public class BoundMQManager : ServicedComponent
        { }

    calling class :- 

                     

    var txOptions = newTransactionOptions {

                                       IsolationLevel = IsolationLevel.ReadCommitted,
                                       Timeout = newTimeSpan(0, 0, 30)
                             };
    using (var scope = newTransactionScope(TransactionScopeOption.RequiresNew, txOptions,
    EnterpriseServicesInteropOption.Full))
                        { //Exception Thrown below when I try to initialize serviced component class

    using (var queueManager = newBoundMQManager
                                {
                                        DefaultQueueName = queueName,
                                        QueueManagerName = QueueManagerName
                                 })
                     {
    //Some Logic goes here
                     }

    scope.Complete();

    }

     I believe, TransactionScope Isolation value is set properly as "ReadCommitted" in both cases, but still NOT working as expected.

    Kindly Advice me on this, Am i missing anything here??

    Thanks in Advance.

    Vishwanath

    Monday, August 6, 2012 7:34 PM

All replies

  • Hi Vishwanath

    For what you tell looks like the Serviced Component has configured a different isolation level than the one you are initiating with your transaction scope.

    As you are starting a new transaction with Full Interop support this means COM+ is going to try to enlist to that transaction. In order to do that your COM+ component needs to be configured with the same isolation Level (Read Commited).

    You can check the service isolation level using the "Component Services" managment console in the COM+ server. Please have a look to check if the isolation level is different.

    For windows xp: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/snap_comp_exp.mspx?mfr=true


    Also, maybe there is no need to start a new transaction from your code. Check as well which transactionality setting have the COM+ package. If it has Required or Required New it will start the transaction by itself, and you will only need your client transaction if you are planning to do multiple actions inside the transaction.

    Let me know if you need more help


    Juan Casanova http://jawsofdotnet.blogspot.com - My .Net babling blog

    Wednesday, August 8, 2012 10:37 AM