English 中文(简体)
Transaction Interop.GetDtc Transaction() sediments ArgumentNullException.
原标题:TransactionInterop.GetDtcTransaction() throws ArgumentNullException... sometimes

I m occasionally getting this exception, and don t seem to be able to find anything here on SO or google that can shed some insight as to 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() ...

我的法典相当直截了当。 RetrieveMessage(>)是发出电离线的呼吁,但那是相关的,因为这只是试图打开联系。

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 looks like the following: Data Source=abc;User ID=test1;Password=test1;Pooling=true;Validate Connection=True

耗氧潜能吨

为什么在我明确制造一个已经存在的交易?

问题回答

我认为,当客户试图使用的TCP港口被数据库服务器以外的代理人或客户关闭时,就会出现这种情况。 我们利用TCPView在客户和服务器之间关闭了1521港的所有联系,然后试图在同一过程中打开联系,从而模拟了这一看法。 在现实世界中,我们认为,由于无所作为,内部防火墙正在关闭连接。 尽管我尚未找到解决这一问题的实际解决办法,但未能防止连接关闭。

If it only sometimes fails, try something like this:

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

索赖,我对“交易”不知很多,因此我可以帮助大家。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签