I have a next code:
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
}
}
error message: The operation is not valid for the state of the transaction.
stack trace:
*at System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
at System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
at NServiceBus.Azure.Transports.WindowsAzureStorageQueues.AzureMessageQueueSender.Send(TransportMessage message, Address address) in c:BuildAgentworka77a0c29cee2af1srcNServiceBus.Azure.Transports.WindowsAzureStorageQueuesAzureMessageQueueSender.cs:line 51
at NServiceBus.Unicast.UnicastBus.SendMessage(List1 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:AmiraProjectSourcesOfAmira-TourAmiraAmira.Merger.WorkerRoleHandlersProcessTPGFilesHandler.cs:line 161
at Amira.Merger.WorkerRole.Handlers.ProcessTPGFilesHandler.DeserializeAndSaveData() in d:AmiraProjectSourcesOfAmira-TourAmiraAmira.Merger.WorkerRoleHandlersProcessTPGFilesHandler.cs:line 139
at Amira.Merger.WorkerRole.Handlers.ProcessTPGFilesHandler.Handle(StartProcessTPGFiles message) in d:AmiraProjectSourcesOfAmira-TourAmiraAmira.Merger.WorkerRoleHandlersProcessTPGFilesHandler.cs:line 122
at lambda_method(Closure , Object , Object )
at NServiceBus.Unicast.HandlerInvocationCache.Invoke(Object handler, Object message, Dictionary
2 dictionary) in :line 0
at NServiceBus.Unicast.HandlerInvocationCache.InvokeHandle(Object handler, Object message) in :line 0
at NServiceBus.Pipeline.Behaviors.LoadedMessageHandlers.b_2(Object handlerInstance, Object message) in :line 0
at NServiceBus.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
at 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
at 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*
can some one help me with this?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…