Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:
Accept: application/json Content-Length: 76 Content-Type: application/x-www-form-urlencoded Host: localhost:44353 X-Correlation-Id: 3ef13d343ac3401f96b3afedae59a4dd
I have a test application that retrieves a token from the server using client_credentials grant.
Whenevet I post using the following code, I get the above error message back
client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); List<KeyValuePair<string, string>> postData = new List<KeyValuePair<string, string>>(); postData.Add(new KeyValuePair<string, string>("grant_type", "client_credentials")); postData.Add(new KeyValuePair<string, string>("client_id", clientId)); postData.Add(new KeyValuePair<string, string>("client_secret", clientSecret)); FormUrlEncodedContent content = new FormUrlEncodedContent(postData); HttpResponseMessage response = await client.PostAsync("connect/token", content);
Further investigation of the ToDynamicListAsync method shows the new module uses System.Linq.Dynamic.Core v 1.2.18 as opposed to the latest 1.3.4.
Upgrading the package fixed the issue.
This was a new module created by the latest version of ABP Suite. V1.2.18 is marked as Vulnerable. This may need to be fixed in the Project Templates.
I was able to get it working with your workaround. This however did not show the cause of the problem, so I started stepping back one change at a time.
I removed the AddTransient code first, then I reverted back to the PagedResult return type.
I reverted back to the old code in indexcshtml.cs and in the end I was left with the following change.
In the end my only changes were:
var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<CustomTestCategory>();
to
var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync();
and 2) added
using Microsoft.EntityFrameworkCore;
I think the issue here is around this method ToDynamicListAsync
This became and issue after I added a Module to the solution that was originally built with 6.0.2 and upgraded to 7.3.2
The error is resolved, but the issue still needs investigation as this will happen with any new entities created.
I have a new 7.3.2 project with a new module. The module has 2 entities CustomTests and CustomTestCategory with the latter being a 1-n property on CustomTests. Whenever I try to load the CustomTests incdex page, I get an error message in the following method in the Index.cshtml.cs file.
When stepping through the code, it seems the GetCustomTestCategoryLookupAsync methos is the problem.
public async Task OnGetAsync()
{
CustomTestCategoryLookupList.AddRange((
await _customTestsAppService.GetCustomTestCategoryLookupAsync(new LookupRequestDto
{
MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount
})).Items.Select(t => new SelectListItem(t.DisplayName, t.Id.ToString())).ToList()
);
await Task.CompletedTask;
}
Provide us with the following info:
1<System.Collections.Generic.List
1<!!0>> System.Linq.Dynamic.Core.DynamicEnumerableAsyncExtensions.ToDynamicListAsync(System.Collections.IEnumerable)'.
TestBuilder.CustomTests.CustomTestsAppService.GetCustomTestCategoryLookupAsync(LookupRequestDto input)System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<!!0>> System.Linq.Dynamic.Core.DynamicEnumerableAsyncExtensions.ToDynamicListAsync(System.Collections.IEnumerable)'.
at TestBuilder.CustomTests.CustomTestsAppService.GetCustomTestCategoryLookupAsync(LookupRequestDto input)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at TestBuilder.CustomTests.CustomTestsAppService.GetCustomTestCategoryLookupAsync(LookupRequestDto input)
at Castle.Proxies.Invocations.ICustomTestsAppService_GetCustomTestCategoryLookupAsync.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.DynamicProxy.AbstractInvocation.ProceedInfo.Invoke()
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 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, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 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.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at TestBuilder.Web.Pages.TestBuilder.CustomTests.IndexModel.OnGetAsync() in D:\LearningWorkspace\Phoenix\Phoenix.HRSuite\aspnet-core\modules\TestBuilder\src\TestBuilder.Web\Pages\TestBuilder\CustomTests\Index.cshtml.cs:line 36
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpOpenIddictMiddlewareExtension.<>c__DisplayClass0_0.<<UseAbpOpenIddictValidation>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Log file shows the same as the stack trace
We have a problem affecting our production environment where we are unable to connect to Redis and it brings the sites down. Below is the error from the Auth Server logs.
* 2023-08-11 05:19:20.878 +00:00 [ERR] No connection is active/available to service this operation: SET GTCManagementProduction:_Phoenix.GTCManagement.AuthServer_AbpExternalLocalizationSaving, mc: 1/1/0, mgr: 10 of 10 available, clientName: app1-vm-prod, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=4,Max=32767), v: 2.2.4.27433
StackExchange.Redis.RedisConnectionException: No connection is active/available to service this operation: SET GTCManagementProduction:_Phoenix.GTCManagement.AuthServer_AbpExternalLocalizationSaving, mc: 1/1/0, mgr: 10 of 10 available, clientName: app1-vm-prod, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=4,Max=32767), v: 2.2.4.27433
at StackExchange.Redis.ConnectionMultiplexer.ThrowFailed[T](TaskCompletionSource`1 source, Exception unthrownException) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2760
--- End of stack trace from previous location ---
at Medallion.Threading.Redis.RedLock.RedLockAcquire.WaitForAcquireAsync(IReadOnlyDictionary`2 tryAcquireTasks) in /_/DistributedLock.Redis/RedLock/RedLockAcquire.cs:line 144
at Medallion.Threading.Redis.RedLock.RedLockAcquire.TryAcquireAsync() in /_/DistributedLock.Redis/RedLock/RedLockAcquire.cs:line 60
at Medallion.Threading.Redis.RedLock.RedLockAcquire.TryAcquireAsync() in /_/DistributedLock.Redis/RedLock/RedLockAcquire.cs:line 94
at Medallion.Threading.Redis.RedisDistributedLock.TryAcquireAsync(CancellationToken cancellationToken) in /_/DistributedLock.Redis/RedisDistributedLock.cs:line 73
at Medallion.Threading.Internal.BusyWaitHelper.WaitAsync[TState,TResult](TState state, Func`3 tryGetValue, TimeoutValue timeout, TimeoutValue minSleepTime, TimeoutValue maxSleepTime, CancellationToken cancellationToken) in /_/DistributedLock.Core/Internal/BusyWaitHelper.cs:line 29
at Medallion.Threading.Internal.Helpers.Convert[TDerived,TBase](ValueTask`1 task, ValueTaskConversion _) in /_/DistributedLock.Core/Internal/Helpers.cs:line 24
at Volo.Abp.DistributedLocking.MedallionAbpDistributedLock.TryAcquireAsync(String name, TimeSpan timeout, CancellationToken cancellationToken)
at Volo.Abp.LanguageManagement.External.ExternalLocalizationSaver.SaveAsync()
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Volo.Abp.LanguageManagement.LanguageManagementDomainModule.<>c__DisplayClass6_1.dqYSTJLxrtjUOO4OmDO.MoveNext()
2023-08-11 05:19:20.878 +00:00 [ERR] ---------- Exception Data ----------
Redis-Multiplexer-Connects = 1/1/0
Redis-Manager = 10 of 10 available
Redis-Client-Name = app1-vm-prod
Redis-ThreadPool-IO-Completion = (Busy=0,Free=1000,Min=1,Max=1000)
Redis-ThreadPool-Workers = (Busy=1,Free=32766,Min=4,Max=32767)
Redis-Busy-Workers = 1
Redis-Version = 2.2.4.27433
redis-command = SET GTCManagementProduction:_Phoenix.GTCManagement.AuthServer_AbpExternalLocalizationSaving
request-sent-status = WaitingToBeSent
I am running my CMD as administrator I have updated my CLI and my ABP suite but when I try updating my ABP to 7.3.0 I get an access denied error.
abp update
ABP CLI 7.3.0
Access to the path 'C:\Users\Chris\Application Data' is denied.
System.UnauthorizedAccessException: Access to the path 'C:\Users\Chris\Application Data' is denied.
at System.IO.Enumeration.FileSystemEnumerator`1.CreateRelativeDirectoryHandle(ReadOnlySpan`1 relativePath, String fullPath)
at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
at Volo.Abp.Cli.Commands.UpdateCommand.UpdateNugetPackages(CommandLineArgs commandLineArgs, String directory, String version) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\UpdateCommand.cs:line 65
at Volo.Abp.Cli.Commands.UpdateCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\UpdateCommand.cs:line 44
at Volo.Abp.Cli.CliService.RunInternalAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 169
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 77
I have run this in my Lambda Console emulator and my windows terminal both as administrator.
I have an API using the same Redis server serving requests at 100ms. I am aware that in a production environment the cache should be hosted closer.
I am absolutely certain this is not the cause of the 35s return time for 12 objects. I am returning a list of countries with 4 properties. I only have 12 countries in the list. It is not a process heavy call, It returns 12 countries in 35 seconds. This happens on first load after which it comes down to 10s. Leaving it a while and returning to the page, the request is back up to 30+ seconds.
I am not sure if there are additional connection checks that could be the cause or whether it may be the storing of data from the database into the cache.
My application runs very slowly when using Redis Cloud database. When I use my local Redis, everything is fine, but as soon as I use Redis cloud, it can take up to 30 seconds for a call returning 12 basic objects.
I have not changes anything on my default Redis settings. My only change is updating the connection string in appsettings.json I am using the following mask [server].east-us-mz.azure.cloud.redislabs.com:[port],user=[userName],password=[password]
My site is running locally on a PC in the UK and the Redis database is on US-East Azure server, so I expect some latency, but 30 seconds is high.