Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

The operation is not valid for the state of the transaction #2174


User avatar
0
bbakermmc created

I keep getting the error of "The operation is not valid for the state of the transaction" when I try to call another method from one of our internal APIs. So the internal API has its own context and makes calls to the DB but it seems ABP is preventing them? I tried with the UOW Disabled and isTransact = false and still no luck. What am I doing wrong?

Controller:

try
            {
                var test = _apiAppService.GetLists(147);
                //using (var api = DmpApi.GetApiInstance(147))
                //{
                //    var test = api.GetDataAugmentationLists();
                //}
            }
            catch (Exception ex)
            {
                var error = ex;
            }

Service:

public class APIAppService : PlatformAppServiceBase, IAPIAppService
    {
        [UnitOfWork(IsDisabled = true)] 
        public List<DAList> GetLists(int clientId)
        {
            var data = new List<DAList>();
                using (var api = DmpApi.GetApiInstance(clientId))
                {
                    data = api.GetDataAugmentationLists();
                }

            return data;
        }
    }

1 Answer(s)
  • User Avatar
    0
    bbakermmc created

    Nevermind, I had to wrap my controller action with the attribute and it was fixed.