我開始使用MassTransit並需要使用RuntimeServices來管理訂閱和超時。我正在安裝的環境是一個使用防火牆的外部網絡。是否有可能阻止MassTransit運行時服務需要DTC?
當前將安裝RuntimeServices的應用程序服務器,並且SQL Server沒有打開允許分佈式事務處理協調器(DTC)正常工作的RPC端口。
我得到的完整例外如下,但重要的部分看起來像是System.Transactions.TransactionException: The operation is not valid for the state of the transaction.
。由於DTC未配置,我不認爲交易正在進行。
雖然我應該可以要求打開正確的端口,但我不願意這麼做,因爲我並不擔心爲此目的進行的交易。所以理想情況下,我想告訴MassTransit,或者是nHibernate,我不需要分佈式事務。
順便說一句,我的MS消息隊列是非事務性的。
任何幫助,歡迎與感謝, 羅布
完整異常堆棧跟蹤:
MassTransit.Context.ServiceBusReceiveContext-'System.Action'1[[MassTransit.IConsumeContext, MassTransit, Version=2.6.416.0, Culture=neutral, PublicKeyToken=null]]' threw an exception consuming message 'MassTransit.Context.ReceiveContext' NHibernate.Exceptions.GenericADOException: could not execute query [ select subscripti0_.CorrelationId as Correlat1_1_, subscripti0_.CurrentState as CurrentS2_1_, subscripti0_.ControlUri as ControlUri1_, subscripti0_.DataUri as DataUri1_ from dbo.SubscriptionClientSaga subscripti0_ where subscripti0_.CurrentState=? ] Name:p1 - Value:Active (State) [SQL: select subscripti0_.CorrelationId as Correlat1_1_, subscripti0_.CurrentState as CurrentS2_1_, subscripti0_.ControlUri as ControlUri1_, subscripti0_.DataUri as DataUri1_ from dbo.SubscriptionClientSaga subscripti0_ where subscripti0_.CurrentState=?] ---> System.Transactions.TransactionException: The operation is not valid for the state of the transaction. at System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) at System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) at NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.EnlistInDis tributedTransactionIfNeeded(ISessionImplementor session) at NHibernate.Impl.AbstractSessionImpl.EnlistInAmbientTransactionIfNeeded() at NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus() at NHibernate.Impl.SessionImpl.get_Batcher() at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) --- End of inner exception stack trace --- at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) ... (elided for brevity!) ...
謝謝ET1975 - 事實證明你的第一個鏈接指向我應該記住的事情 - 在我的連接字符串的末尾添加Enlist = false以確保SQL請求不參與DTC事務。 – WooWaaBob 2013-03-13 15:04:53