Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Microsoft.Data.SqlClient.SqlTransaction.ZombieCheck() with EF Core

$
0
0

Hello everyone and thanks for the help in advance.  I am developing a .Net Core 3.1 web application that is an endpoint for a Twilio api service that receives update posts from the Twilio api.  The posts are then logged to a SQL Server 2012 database using EF Core.  However, I am intermittently encountering the error:

System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable. at Microsoft.Data.SqlClient.SqlTransaction.ZombieCheck() at Microsoft.Data.SqlClient.SqlTransaction.Commit() at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit() at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(DbContext _, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) 

when I try to perform a simple insert into the database.  Here is my code:

                using (var ctx = new myDbContext())
                {
                    ctx.tbl_Log_SMSValidation.Add(new tbl_Log_SMSValidation()
                    {

                        From = From,
                        SmsMessageSid = SmsSid,
                        SmsStatus = SmsStatus,
                        To = To,
                        Status = ResponseStatus,
                        RequestUrl = requestUrl,
                        Signature = signature

                    }); 

                    ctx.SaveChanges();
                }

In researching this error, it seems to advise looking at the underlying SQL, but this is nothing complex and I have no idea why its failing.  The application does receive many inbound posts since we will send several thousand text messages, but I'm not sure this is the problem.  Any help would be appreciated.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>