The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements. code example
Example 1: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
if __name__ == "__main__":
app.secret_key = 'super secret key'
app.config['SESSION_TYPE'] = 'filesystem'
sess.init_app(app)
app.debug = True
app.run()
Example 2: An ambient transaction has been detected. The ambient transaction needs to be completed before beginning a transaction on this connection.
using (var ambientTxn = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
using (var txn = await context.Database.BeginTransactionAsync())
{
}