Alexey,
MSDTC can abort a transaction at any time. By creating a COM+ object marked "Transaction-Not Supported" you will ensure that the code that runs in that component will not participate in the transaction of the caller (if any), nor the component will create a transaction of its own.
I don't understand what you mean by "transactioned" part of .NET code. Can you clarify?
Cheers!
Main Func() And I try to figure why this can happend and how to fix it Did I clarify or you need more information ?
{
...
parse data
...
create instance of biz object using parsed data
call instance method method1()
}
and method1:
method1()
{
...
do something
...
create instance of COM (COM DLL marked as Transaction Not supported)
...
call COM.Method2
...
store everything to MSSQL DB
}
and sometimes we catch exception "Import (or Enlist ) of MSDTC transaction failed", which thrown up to Main and written to exception log.
Yes, this helps. Can you also provide the stack of the exception? Also what operating systems are you using? Is the SQL Server on the same computer as the client?
Thanks.
Stack traces ( 2 different, with note in there):
General Information
*********************************************
Additional Info:
ExceptionManager.MachineName: REGSERVER1
ExceptionManager.TimeStamp: 24.05.2006 10:22:13
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1.84, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: productservices.service.exe
ExceptionManager.ThreadIdentity: FINE\ARbase_post
ExceptionManager.WindowsIdentity: FINE\ARbase_post
1) Exception Information
*********************************************
Exception Type: Abbyy.ActivationDatabase.ProductServices.Data.Common.BusinessObject.BusinessObjectException
ErrorCode: DataProviderError
Message: DataProviderError
TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
HelpLink: NULL
Source: mscorlib
StackTrace Information
*********************************************
Server stack trace:
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.GetSerialNumberActivationStatus(String serialNumber, String installationCode) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 807
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 95
at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target, Boolean fExecuteInContext)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 47
at Abbyy.ActivationDatabase.ProductServices.ProductServiceBase.ActivateSerialNumber(ActivationRequest activationRequest, String serialNumber) in D:\Projects\ActivationRegistration\ARDB\ProductServices.v1\ProductServiceBase.cs:line 481
2) Exception Information
*********************************************
Exception Type: System.Data.SqlClient.SqlException
Errors: System.Data.SqlClient.SqlErrorCollection
Class: 16
LineNumber: 0
Message: Import of MSDTC transaction failed: Result Code = 0x8004d00e.
(and sometimes occures with Result Code = 0x8004d019)
Number: 8509
Procedure:
Server:
State: 1
Source: .Net SqlClient Data Provider
TargetSite: Void OnError(System.Data.SqlClient.SqlException, System.Data.SqlClient.TdsParserState)
HelpLink: NULL
StackTrace Information
*********************************************
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
at System.Data.SqlClient.TdsParser.PropagateDistributedTransaction(Byte[] buffer, Int32 length, Int32 timeout)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNullDistributedTransaction(ITransaction transaction)
at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction(ITransaction newTransaction, Guid newTransactionGuid)
at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction()
at System.Data.SqlClient.SqlInternalConnection.Activate(Boolean isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.GetSerialNumberActivationStatus(String serialNumber, String installationCode) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 784
==============================================================
Second trace
General Information
*********************************************
Additional Info:
ExceptionManager.MachineName: REGSERVER1
ExceptionManager.TimeStamp: 24.05.2006 9:09:01
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1.84, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: productservices.service.exe
ExceptionManager.ThreadIdentity: FINE\ARbase_post
ExceptionManager.WindowsIdentity: FINE\ARbase_post
1) Exception Information
*********************************************
Exception Type: Abbyy.ActivationDatabase.ProductServices.Data.Common.BusinessObject.BusinessObjectException
ErrorCode: DataProviderError
Message: DataProviderError
TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
HelpLink: NULL
Source: mscorlib
StackTrace Information
*********************************************
Server stack trace:
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.FindActivationRecords(String serialNumber, String installationId) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 604
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 133
at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target, Boolean fExecuteInContext)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 47
at Abbyy.ActivationDatabase.ProductServices.ProductServiceBase.ActivateSerialNumber(ActivationRequest activationRequest, String serialNumber) in D:\Projects\ActivationRegistration\ARDB\ProductServices.v1\ProductServiceBase.cs:line 481
2) Exception Information
*********************************************
Exception Type: System.Data.SqlClient.SqlException
Errors: System.Data.SqlClient.SqlErrorCollection
Class: 20
LineNumber: 0
Message: Enlist of MSDTC transaction failed: Result Code = 0x8004d00e.
Number: 8510
Procedure:
Server:
State: 1
Source: .Net SqlClient Data Provider
TargetSite: Void OnError(System.Data.SqlClient.SqlException, System.Data.SqlClient.TdsParserState)
HelpLink: NULL
StackTrace Information
*********************************************
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
at System.Data.SqlClient.TdsParser.PropagateDistributedTransaction(Byte[] buffer, Int32 length, Int32 timeout)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNullDistributedTransaction(ITransaction transaction)
at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction(ITransaction newTransaction, Guid newTransactionGuid)
at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction()
at System.Data.SqlClient.SqlInternalConnection.Activate(Boolean isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.FindActivationRecords(String serialNumber, String installationId) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 566
Tell me please, if you need more information about our system
It looks that your transactions are being aborted. This may be because of the first exception: BusinessObjectException or because of a timeout.
If one method of a transactional ServicedComponent is throwing an exception, the transaction will immediately abort. You should not attempt to do any subsequent work after this as part of the transaction that was just aborted.
If my answer doesn't help, please explain at what point in time & execution do you get BusinessObjectException and what do you do when you get the exception.
One other avenue is to enable tracing to confirm where the abort is comming from: http://support.microsoft.com/Default.aspx?kbid=899115
HTH
If one method of a transactional ServicedComponent is throwing an exception, the transaction will immediately abort. You should not attempt to do any subsequent work after this as part of the transaction that was just aborted.
Here is today error 15:08 (accoding to inner exception from trace entry - happen when
SQLHelper (from MS App Block) ExecuteNonQuery called. TX entries