0

A timeout error occurred while registering the record or updating the records in the database.

"The timeout period elapsed prior to completion of the operation or the server is not responding."

Application throw DbUpdateException error on running the update API.

Error below -

  • Microsoft.EntityFrameworkCore.DbUpdateException
  • System.ComponentModel.Win32Exception (258): The wait operation timed out.
Jason Pan
  • 15,263
  • 1
  • 14
  • 29
Anjali Vyas
  • 9
  • 1
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 20 '22 at 13:58

1 Answers1

1

The default value of CommandTimeout is 30s. You can modify it according to your needs.

In your Program.cs file (.Net 6),

builder.Services.AddDbContext<ApplicationDbContext>(
    options =>options.UseSqlServer(connectionString, op => 
        op.CommandTimeout(60)));

Or you can set it through your context.

Related Post:

What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?

Jason Pan
  • 15,263
  • 1
  • 14
  • 29