Currently, my program makes use of NService bus and it queries the database a lot of the time. Issue is, when it gets to a certain point in the process, it always gets this error
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)
Now, I’ve just been able to solve this by increasing the machine timeout in machine.config. I basically followed this post.
Now, if it’s ok to find out. Is there any other way I could’ve done this?
Based on research, I feel that the database lookup is taking way to long for the handler’s transaction scope - or something along those lines.
Now, I’ve changed the machine.config. In the link above, there’s also a comment -following the link - the comment is a method on how to change this value on the fly at run time - which I prefer.
Can I please confirm it’s ok to do this or is there a different was to solve my problems?
Also, I did this on both the servers that’s hosting the application and the SQL server - out of desperation. Should I have just done this on the application server?
Look forward to your responses.