1. The query method is tested separately successfully, and the httpget interface is called successfully. However, if it is called by the httpput or httppost interface, an error [err] beginexecutereader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction The Transaction property of the command has not been initialized.
Temporary processing method: using (idbconnection = dbconnection){
…connection.QueryAsync<T>…
}
Change to
DbConnection.QueryAsync< T>
2. If the above method is still unsuccessful, add the [unitofwork (false, isolationlevel. Readcommitted)] attribute to the httppost interface of the controller layer.