Transaction operation could not be completed because requests are expected to process this transaction

I get an error like:

An error was reported while committing a database transaction, but could not determine whether the transaction was successful or failed on the database server. See Internal Exception and http://go.microsoft.com/fwlink/?LinkId=313468 for more information .

Transaction operation could not be completed due to pending requests for this transaction.

I am trying to insert data into a database using Entity Frameowrk using the MapStoredProcedure approach.

My code is:

this.MapToStoredProcedures(e => e.Insert(v => v.HasName("uspInsertUser").Result(rs => rs.UserId, "UserId"))); public ActionResult Add(User userDetails) { try { _unitOfWorkAsync.BeginTransaction(); _userService.Insert(userDetails); _unitOfWorkAsync.SaveChangesAsync(); _unitOfWorkAsync.Commit(); // This line gives error ModelState.Clear(); return View("Add"); } catch (Exception ex) { _unitOfWorkAsync.Rollback(); throw ex; } 

The strangest thing about this is if I hold a breakpoint and debug the code by inserting it to insert.

However, when I paste without a breakpoint enabled, this gives me the error above. Any help is appreciated.

+6
source share

Source: https://habr.com/ru/post/985045/


All Articles