Product name: NServiceBus / NServiceBus.Azure
Version: 4.1.3
We're seeing this exception message show up intermittently:
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 NServiceBus.Unicast.Queuing.Azure.ServiceBus.AzureServiceBusMessageQueueSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\ba77a0c29cee2af1\src\NServiceBus.Azure\Transports\ServiceBus\AzureServiceBusMessageQueueSender.cs:line 53
at NServiceBus.Unicast.UnicastBus.SendMessage(List`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(Object[] messages) in :line 0
We can't tell what is causing it, and we typically see that the message succeeds on the next attempt (first level retry). Still, we'd love to be able to eliminate them if there is some configuration or work around that could prevent them from coming up.
In researching it, I found this post:
It's the same exception, but coming from a Bus.Publish. We do not explicitly call
Config.Transactions.Disable()
Should we add this call to the initialization of all of our azure deployed endpoints, and if so, do we also need to include the following?
Configure.Transactions.Advanced(t => t.DisableDistributedTransactions().DoNotWrapHandlersExecutionInATransactionScope());