我开始使用MassTransit并需要使用RuntimeServices来管理订阅和超时。我正在安装的环境是一个面向外部的网络,使用防火墙分成几个部分。
目前,要安装RuntimeServices的应用程序服务器和SQL Server没有打开RPC端口,这将允许分布式事务处理协调器(DTC)正常工作。
下面列出了我得到的完整例外情况,但重要部分看起来像是System.Transactions.TransactionException: The operation is not valid for the state of the transaction.
。由于未配置DTC,我不相信交易正在开始。
虽然我应该能够要求打开正确的端口,但我不愿意这样做,因为我不关心为此目的进行的交易。理想情况下,我想告诉MassTransit,或者也许是nHibernate,我不需要分布式事务。
BTW我的MS Message Queue是非交易的。
欢迎致谢, 罗布
完整的异常堆栈跟踪:
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!) ...
答案 0 :(得分:0)
在某些情况下,交易会自动提升为DTC:http://msdn.microsoft.com/en-us/library/ms131083.aspx
你肯定希望避免这种情况发生 - 它会杀死性能,选项:
https://groups.google.com/forum/?fromgroups#!forum/masstransit-discuss是您可以快速获得MassTransit帮助的地方。
干杯, ET。