其他分享
首页 > 其他分享> > ABP框架钟使用Dapper时,HttpPost调用接口报错解决办法

ABP框架钟使用Dapper时,HttpPost调用接口报错解决办法

作者:互联网

1、Query方法单独测试成功,HttpGet接口调用成功,但是如果是HttpPut或者HttpPost接口调用则会报错[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.

临时处理方法:using (IDbConnection connection = DbConnection){

…connection.QueryAsync<T>…

}

改为

DbConnection.QueryAsync<T>

 

 

2、以上方法还是不成功的话,则在controller层的httppost接口加上[UnitOfWork(false, IsolationLevel.ReadCommitted)]属性即可。

 

标签:调用,接口,ABP,connection,command,HttpPost,报错
来源: https://www.cnblogs.com/AnnsBlog/p/15512371.html