2011-12-22 43 views
0

我有一个使用COM OBJ错误:虽然DTC配置

using (TransactionScope ts = 
       new TransactionScope(TransactionScopeOption.Required, 
        new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted })) 
      { 

... 

       ts.Complete(); 
      } 

我收到以下错误一些C#代码。你知道为什么吗?

Server Error in '/MyApp' Application.

Error HRESULT E_FAIL has been returned from a call to a COM component.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.]
System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim) +0
System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken) +384

[TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed.]
System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken) +259971
System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx) +209
System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx) +339
System.Transactions.EnlistableStates.Promote(InternalTransaction tx) +21 System.Transactions.Transaction.Promote() +60 System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction) +71
System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) +309
System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts) +45
System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) +630
System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) +45
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1466
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +84
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +1645767
System.Data.SqlClient.SqlConnection.Open() +258

+0

令人敬畏的异常消息,详细和不说。 E_FAIL糟透了,除了“无法做到,不知道为什么”之外没有任何意义。每个人使用Java代替COM +的主要原因。你需要微软支持,如果修改配置或魔术SO帖子不解决它。 – 2011-12-22 15:21:37

+0

如果启用了防火墙,请确保它已配置为使用MSDTC。如果不是这样,重新安装MSDTC,正如user9 ...所暗示的,有时会神奇地修复它。 – 2011-12-22 17:45:30

回答

0

[TransactionManagerCommunicationException:与底层事务管理器的通信失败。] - 这表示MSDTC未安装或未正常工作。你可以尝试安装/重新安装MSDTC并启用它。