The following code example shows how to solve the error Failed executing DbCommand Update in Asp.Net Core and EF Entity Framework.
Task: my Asp.Net Core 2 MVC application hangs up regularly when a record is to be written.
This is a simple counter that increases website access.
The error message in the log file of the Asp Core application is:
fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (45ms) [Parameters=[@p1='?', @p0='?'], CommandType='Text', CommandTimeout='30'] .. UPDATE [tbl_Notes] SET .. System.Data.SqlClient.SqlException (0x80131904): Timeout expired. |
And this comes the error:
fail: Microsoft.EntityFrameworkCore.Update[10000] An exception occurred in the database while saving changes for context type |
Log file of asp application