1

トランザクション スコープが頻繁に中止される

その背後にある私の問題:

異なるクラスで複数のトランザクションスコープを開くと、トランザクションが中止されたというエラーに直面し、すべてのクラスがネストされ、メソッドでトランザクションスコープが初期化されますが、トランザクションスコープが宣言されたメソッドは呼び出されませんが、タイムアウトとトランザクションが発生しますスコープは繰り返し中止されます。

私のスタックトレースは次のとおりです:

System.Transactions.TransactionAbortedException がキャッチされました
HResult=-2146233087 Message=トランザクションは中止されました。
ソース=System.Transactions

StackTrace:
       at System.Transactions.TransactionStatePromotedAborted.CreateAbortingClone(InternalTransaction tx)
       at System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking)
       at System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)
       at System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)
       at System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption)
       at TrapError.ErrorDescription..ctor()
       at QueryRecordsets.FetchRecordsets..ctor()
  InnerException: System.TimeoutException
       HResult=-2146233083
       Message=Transaction Timeout
       InnerException:   

エラーの説明を分析しているときに、次の情報があります。

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 10/30/2013 9:19:31 AM 
Event time (UTC): 10/30/2013 3:49:31 AM 
Event ID: 057d425ae7424adbb9a021d856f0d3e0 
Event sequence: 14 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT/eSmartDotNet-2-130275784247371995 
    Trust level: Full 
    Application Virtual Path: /eSmartDotNet 
    Application Path: I:\Rafiq\29-10-2013\Source Code Esmart Application\ 
    Machine name: WINSERVER2012 

Process information: 
    Process ID: 4908 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\DefaultAppPool 

Exception information: 
    Exception type: HttpUnhandledException 
    Exception message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The transaction has aborted.
   at QueryRecordsets.FetchRecordsets..ctor()
   at ASP.logincheck_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in I:\Rafiq\29-10-2013\Source Code Esmart Application\LoginCheck.aspx:line 42
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Page.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Transaction Timeout



Request information: 
    Request URL: http://localhost/eSmartDotNet/LoginCheck.aspx 
    Request path: /eSmartDotNet/LoginCheck.aspx 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\DefaultAppPool 

Thread information: 
    Thread ID: 33 
    Thread account name: IIS APPPOOL\DefaultAppPool 
    Is impersonating: False 
    Stack trace:    at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
4

1 に答える 1

1

TransactionScope が Oracle で動作するかどうかはわかりません。私の直感では、MS Distributed Transaction Coordinator (MSDTC) などの MS テクノロジに依存しているということです。これは、 System.Transactions 名前空間に関する MSDN ドキュメントで確認されているようです(MS テクノロジを強調しています)。

System.Transactions インフラストラクチャは、SQL Server、ADO.NET、MSMQ、およびMicrosoft Distributed Transaction Coordinator (MSDTC)で開始されたトランザクションをサポートすることにより、プラットフォーム全体でトランザクション プログラミングをシンプルかつ効率的にします。これは、Transaction クラスに基づく明示的なプログラミング モデルと、トランザクションがインフラストラクチャによって自動的に管理されるTransactionScope クラスを使用した暗黙的なプログラミング モデルの両方を提供します。

また、Oracle での動作に問題があることを示しているように見える SO の投稿も多数あります。

System.Data.OracleClient での TransactionScope の使用 - TransactionAbortedException

TransactionScope と Oracle の問題

ASP.NET を使用した Oracle のトランザクション スコープ

最後のリンクは、Oracle 固有の DTC を示しているようですが、まだあまり期待できません。TransactionScope 以外のトランザクションを処理するための他の代替手段を検討する必要がある場合があります。

于 2013-10-30T05:48:18.547 に答える