- ABP Framework version: v4.4.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
Hi,
we have product page with tree view( for category) and tax details table .we couldn't get selected element ids with default OnPOST ,so we use ajax call to send data to another OnPOSTSAVE methods.For your reference, JS on form submit event we call ajax
CS(Razor page)
Here line no 126 throws Operation cancelled exception so UpdateAsync in ProductAppService not hittng
Exception
at System.Net.Http.HttpConnection.<SendAsyncCore>d__56.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Net.Http.HttpConnectionPool.<SendWithRetryAsync>d__72.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.RedirectHandler.<SendAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.DiagnosticsHandler.<SendAsyncCore>d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendAsync>d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.HttpClient.<SendAsyncCore>d__85.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.<MakeRequestAsync>d__42.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.<MakeRequestAndGetResultAsync>d__41`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.<GetResultAsync>d__40.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.<InterceptAsync>d__39.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.<InterceptAsync>d__3`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Castle.DynamicProxy.AsyncInterceptorBase.<ProceedAsynchronous>d__14`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.<ProceedAsync>d__7.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Validation.ValidationInterceptor.<InterceptAsync>d__2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.<InterceptAsync>d__3`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at GenieERP.Web.Pages.Products.EditModalModel.<OnPostSaveProductAsync>d__38.MoveNext() in E:\Projects\GenieERP\GenieERP\src\GenieERP.Web\Pages\Products\EditModal.cshtml.cs:line 126
**Note: This ajax call working fine when creating new product but we got this issue only in updating product **
20 Answer(s)
-
0
-
0
StackTrace
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token) at System.Net.Security.SslStream.<ReadAsyncInternal>d__181`1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Net.Http.HttpConnection.
Api
2021-12-07 09:38:40.671 +05:30 [INF] Request starting HTTP/1.1 PUT https://localhost:44321/api/app/products/0?api-version=1.0 application/json;+charset=utf-8 371 2021-12-07 09:38:40.673 +05:30 [INF] Successfully validated the token. 2021-12-07 09:38:40.674 +05:30 [INF] Executing endpoint 'GenieERP.Controllers.Products.ProductController.UpdateAsync (GenieERP.HttpApi)' 2021-12-07 09:38:40.678 +05:30 [INF] Route matched with {area = "app", controller = "Product", action = "Update", page = ""}. Executing controller action with signature System.Threading.Tasks.Task
1[GenieERP.Products.ProductDto] UpdateAsync(Int32, GenieERP.Products.ProductUpdateDto) on controller GenieERP.Controllers.Products.ProductController (GenieERP.HttpApi). 2021-12-07 09:38:40.995 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:7aed9f0c-b2d6-df01-2306-39fd214740c6,n:GenieERP.Products.Edit 2021-12-07 09:38:41.000 +05:30 [WRN] The operation was canceled. System.OperationCanceledException: The operation was canceled. at System.Threading.CancellationToken.ThrowOperationCanceledException() at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token) at Volo.Abp.Caching.DistributedCache
2.GetAsync(TCacheKey key, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token) 2021-12-07 09:38:41.008 +05:30 [DBG] Not found in the cache: pn:U,pk:7aed9f0c-b2d6-df01-2306-39fd214740c6,n:GenieERP.Products.Edit 2021-12-07 09:38:41.013 +05:30 [DBG] Getting all granted permissions from the repository for this provider name,key: U,7aed9f0c-b2d6-df01-2306-39fd214740c6 2021-12-07 09:38:41.050 +05:30 [INF] Entity Framework Core 5.0.12 initialized 'PermissionManagementDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: QuerySplittingBehavior=SplitQuery 2021-12-07 09:38:41.073 +05:30 [ERR] An error occurred using the connection to database 'genieerp' on server 'tcp:cozydev.database.windows.net,1433'. 2021-12-07 09:38:41.111 +05:30 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }2021-12-07 09:38:41.111 +05:30 [ERR] A task was canceled. System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider
1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider
1.CreateDbContextAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider
1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.PermissionManagement.EntityFrameworkCore.EfCorePermissionGrantRepository.GetListAsync(String providerName, String providerKey, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) at Volo.Abp.PermissionManagement.PermissionStore.SetCacheItemsAsync(String providerName, String providerKey, String currentName, PermissionGrantCacheItem currentCacheItem) at Volo.Abp.PermissionManagement.PermissionStore.GetCacheItemAsync(String name, String providerName, String providerKey) at Volo.Abp.PermissionManagement.PermissionStore.IsGrantedAsync(String name, String providerName, String providerKey) at Volo.Abp.Authorization.Permissions.UserPermissionValueProvider.CheckAsync(PermissionValueCheckContext context) at Volo.Abp.Authorization.Permissions.PermissionChecker.IsGrantedAsync(ClaimsPrincipal claimsPrincipal, String name) at Volo.Abp.Authorization.PermissionRequirementHandler.HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) at Microsoft.AspNetCore.Authorization.AuthorizationHandler1.HandleAsync(AuthorizationHandlerContext context) at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, IEnumerable
1 requirements) at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.AuthorizeAsync(IAuthorizationService authorizationService, Object resource, AuthorizationPolicy policy) at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.AuthorizeAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy) at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.IsGrantedAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy) at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy) at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context) at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation) at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) at lambda_method6176(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker. -
0
2021-12-07 09:38:41.073 +05:30 [ERR] An error occurred using the connection to database 'genieerp' on server 'tcp:cozydev.database.windows.net,1433'.
-
0
Whats the reason for this error? bcz same code working ,when creating new product.Am i missing anything?
-
0
I cannot confirm the reason according to the current log info.
-
0
2021-12-07 09:38:40.678 +05:30 [INF] Route matched with {area = "app", controller = "Product", action = "Update", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[GenieERP.Products.ProductDto] UpdateAsync(Int32, GenieERP.Products.ProductUpdateDto) on controller GenieERP.Controllers.Products.ProductController (GenieERP.HttpApi). 2021-12-07 09:38:40.995 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:7aed9f0c-b2d6-df01-2306-39fd214740c6,n:GenieERP.Products.Edit 2021-12-07 09:38:41.000 +05:30 [WRN] The operation was canceled. System.OperationCanceledException: The operation was canceled. at System.Threading.CancellationToken.ThrowOperationCanceledException() at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token) at Volo.Abp.Caching.DistributedCache2.GetAsync(TCacheKey key, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token) 2021-12-07 09:38:41.008 +05:30 [DBG] Not found in the cache: pn:U,pk:7aed9f0c-b2d6-df01-2306-39fd214740c6,n:GenieERP.Products.Edit 2021-12-07 09:38:41.013 +05:30 [DBG] Getting all granted permissions from the repository for this provider name,key: U,7aed9f0c-b2d6-df01-2306-39fd214740c6 2021-12-07 09:38:41.050 +05:30 [INF] Entity Framework Core 5.0.12 initialized 'PermissionManagementDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: QuerySplittingBehavior=SplitQuery
this is the log before this , 2021-12-07 09:38:41.073 +05:30 [ERR] An error occurred using the connection to database 'genieerp' on server 'tcp:cozydev.database.windows.net,1433'.
You're simply mentioning connection to database error.Then how can we identify the issue?
-
0
You should try to troubleshoot the database, such as changing to a local database or check its logs.
-
0
As u said, i changed to local db and check its logs ..same db connection error
-
0
Hi
Any solution?
-
0
Can you provide a project so that I can reproduce the problem? liming.ma@volosoft.com
-
0
Hi,
I shared via One-Drive. Please check and confirm.
-
0
hi
I downloaded your project, can you share the steps?
-
0
1.Login as admin 2.Goto Product Settings->Product from menu 3.Edit product and click save button.
U need to add some sample master data in site settings,tax settings and product settings
-
0
U need to add some sample master data in site settings,tax settings and product settings
You can create a
DataSeedContributor
to seed these data likeIdentityServerDataSeedContributor
.BTW: Never call the Result of an asynchronous method but use await
Maybe this is the cause of the error.
public async Task<List<PurchaseOrder>> GetNearDueDatesAsync() { var CurrentDate = DateTime.Today; var statusId = _statusRepository.GetListAsync().Result.FirstOrDefault(r => r.Name.ToUpper() == StatusConsts.OpenStatus.ToUpper()).Id; var query = (await GetDbContextAsync()).PurchaseOrders .Where(x => x.DeliveryDueDate.Date >= CurrentDate.Date && x.StatusId == statusId); return await query.Take(DashboardConsts.ShowDataCount).ToListAsync(); }
to
public async Task<List<PurchaseOrder>> GetNearDueDatesAsync() { var CurrentDate = DateTime.Today; var statusId = (await _statusRepository.GetListAsync()).FirstOrDefault(r => r.Name.ToUpper() == StatusConsts.OpenStatus.ToUpper()).Id; var query = (await GetDbContextAsync()).PurchaseOrders .Where(x => x.DeliveryDueDate.Date >= CurrentDate.Date && x.StatusId == statusId); return await query.Take(DashboardConsts.ShowDataCount).ToListAsync(); } ``
-
0
ok we will add DataSeedContributor in future. Now do u want project with DataSeedContributor ?
-
0
You can share it to liming.ma@volosoft.com
-
0
hi @maliming ,
I updated our source code in one-drive.Please download again and check.
For now i added some master data(in Site settings,product settings,tax settings) which is required only for Product.
You still may get error in dashboard because no data in purchase order.You can skip and still able to navigate to Product Screen.
-
0
-
0
Hi @maliming ,
Thanks!!! Now working.
-
0
: )