今天調試WCF事務代碼遇到這個問題:The Transaction has aborted,事務已經被中斷。
具體信息如下圖:
解決辦法:
1.Transaction timed out 設置問題。增加配置代碼火屬性:
<serviceBehaviors>
<behavior name="WCFService.WCFServiceBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true">
</serviceDebug>
<serviceTimeouts transactionTimeout="00:30:00"/>
</behavior>
</serviceBehaviors>
2.如果你設置了[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete =false)]:
增加OperationContext.Current.SetTransactionComplete(),在符合要求的代碼裡提交事務。
3.我在還繼續查找其它的解決辦法。
查找到資料:
1.http://social.msdn.microsoft.com/Forums/en-US/windowstransactionsprogramming/thread/5eab0a10-b0f8-42e3-b870-463c912a4d2e;
2.http://netindonesia.net/blogs/kasim.wirama/archive/2007/12/11/transaction-in-windows-communication-foundation-wcf.aspx;
3.http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/9f9c1d11-6c0d-423e-bffc-4d1957e9bdd7;
歡迎補充!~~