TransactionInterop.GetDtcTransaction () throws an ArgumentNullException ... sometimes

I sometimes get this exception and it seems like I can't find anything here in SO or google that can shed some insight on how to debug this.

System.ArgumentNullException: Value cannot be null.
Parameter name: transaction
   at System.Transactions.TransactionInterop.
                        GetDtcTransaction(Transaction transaction)
   at Oracle.DataAccess.Client.OracleConnection.Open()
   at RetrieveMessage() ...

My code is pretty simple. RetrieveMessage()- This is a call to pull the message out of the queue, but it does not matter, since it is not just an attempt to open a connection.

using (var scope = new TransactionScope(TransactionScopeOption.Required,
                                            TimeSpan.FromMinutes(10)))
{
    message = RetrieveMessage();
    // ...
    scope.Complete();
}

//...

public Message RetrieveMessage()
{
    using (var cnn = new OracleConnection(ConnString))
    {
        cnn.Open(); //sometimes fails???
        //... execute a stored procedure that calls dbms_aq.dequeue()
    }
    //... return dequeued message or null if queue is empty
}

My connection string is as follows: Data Source=abc;User ID=test1;Password=test1;Pooling=true;Validate Connection=True

ODP.NET: version 2.112.1.0, .NET Framework 3.5 SP0

Why not make the transaction available if I already created it already?

+3
source share
2 answers

, , TCP-, , , . , TCPView, 1521 , . , - . , .

+1

, - :

while (true){
    if (ConnString == null)
        continue;
    var cnn = new OracleConnection(ConnString);
    if (cnn == null)
        continue;
    cnn.Open()
    //... execute a stored procedure that calls dbms_aq.dequeue() 
    break;
}
//... return dequeued message or null if queue is empty

, "", ,

-1

All Articles