我有下一个代码:
class ProcessHandler : IHandleMessages<StartProcess>
{
public IBus Bus { get; set; }
public void Handle(StartProcess message)
{
//some long living process (over 3 min)
Bus.SendLocal(new SameMessage()); //get error here
}
}
错误信息:操作对于事务的状态无效。
堆栈跟踪:
*在 System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) 在 System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) 在 NServiceBus.Azure.Transports.WindowsAzureStorageQueues.AzureMessageQueueSender.Send( TransportMessage 消息,地址地址)在 c:\BuildAgent\work\ba77a0c29cee2af1\src\NServiceBus.Azure.Transports.WindowsAzureStorageQueues\AzureMessageQueueSender.cs:NServiceBus.Unicast.UnicastBus.SendMessage 的第 51 行(列表1 addresses, String correlationId, MessageIntentEnum messageIntent, Object[] messages) in :line 0
at NServiceBus.Unicast.UnicastBus.SendMessage(Address address, String correlationId, MessageIntentEnum messageIntent, Object[] messages) in :line 0
at NServiceBus.Unicast.UnicastBus.Send(Address address, Object[] messages) in :line 0
at NServiceBus.Unicast.UnicastBus.SendLocal(Object[] messages) in :line 0
at NServiceBus.Unicast.UnicastBus.SendLocal(Object message) in :line 0
at Amira.Merger.WorkerRole.Handlers.ProcessTPGFilesHandler.SaveToDataBase(TourML tourMLObj) in d:\AmiraProject\SourcesOfAmira-Tour\Amira\Amira.Merger.WorkerRole\Handlers\ProcessTPGFilesHandler.cs:line 161
at Amira.Merger.WorkerRole.Handlers.ProcessTPGFilesHandler.DeserializeAndSaveData() in d:\AmiraProject\SourcesOfAmira-Tour\Amira\Amira.Merger.WorkerRole\Handlers\ProcessTPGFilesHandler.cs:line 139
at Amira.Merger.WorkerRole.Handlers.ProcessTPGFilesHandler.Handle(StartProcessTPGFiles message) in d:\AmiraProject\SourcesOfAmira-Tour\Amira\Amira.Merger.WorkerRole\Handlers\ProcessTPGFilesHandler.cs:line 122
at lambda_method(Closure , Object , Object )
at NServiceBus.Unicast.HandlerInvocationCache.Invoke(Object handler, Object message, Dictionary
2 字典)在:NServiceBus.Unicast.HandlerInvocationCache.InvokeHandle(对象处理程序,对象消息)的第 0 行中:NServiceBus.Pipeline.Behaviors.LoadedMessageHandlers.b_ 的第 0 行中2(对象 handlerInstance,对象消息)在:NServiceBus 的第 0 行.Pipeline.Behaviors.InvokeHandlersBehavior.DispatchMessageToHandlersBasedOnType(IBuilder builder, LogicalMessage toHandle, LoadedMessageHandlers loadedHandlers, BehaviorContext context) in :line 0 at NServiceBus.Pipeline.Behaviors.InvokeHandlersBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline .BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain.<>c _DisplayClass1.b_0() in :line 0 at NServiceBus.Sagas.SagaPersistenceBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain。< >c _DisplayClass1.b_ 0() in :line 0 at NServiceBus.Pipeline.Behaviors.LoadHandlersBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain.<>c _DisplayClass1.b_0() in :line 0 at NServiceBus.Pipeline.Behaviors.CallbackInvocationBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain .<>c _DisplayClass1.b_ 0() in :line 0 at NServiceBus.Pipeline.Behaviors.ApplyIncomingMessageMutatorsBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 在 NServiceBus.Pipeline.BehaviorChain.<>c _DisplayClass1.b_0() in :line 0 at NServiceBus.Pipeline.Behaviors.ExtractLogicalMessagesBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain .<>c _DisplayClass1.b_ 0() in :line 0 at NServiceBus.Pipeline.Behaviors.RaiseMessageReceivedBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 在 NServiceBus.Pipeline.BehaviorChain.<>c _DisplayClass1.b_0() in :line 0 at NServiceBus.Pipeline.Behaviors.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(BehaviorContext context, Action next) in :line 0 at NServiceBus.Pipeline.BehaviorChain.InvokeNext(BehaviorContext context) in :line 0 at NServiceBus.Pipeline.BehaviorChain .<>c _DisplayClass1.b__0() in :line 0 at NServiceBus.UnitOfWork.UnitOfWorkBehavior.Invoke(BehaviorContext context, Action next) in :line 0*
有人可以帮我弄这个吗?谢谢