2011-12-22 80 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並啓用它。