hi lanpin
Can you create a new question?
Thanks.
Great, we also released 10.1.1. You can try upgrading and removing the patch code.
https://github.com/abpframework/abp/releases/tag/10.1.1
Thanks.
hi
This is not a problem, one request is anonymous and the other is authenticated. This is by design, and when you solve the slow problem, this is no longer a problem.
Thanks.
hi
Switch Ocelot to YARP for the API Gateway Until this version, ABP Commercial was using the Ocelot for the API Gateway, in the Microservice Startup Template. Since the Ocelot library is not actively maintained, we have searched for an alternative and decided to switch from Ocelot to YARP for the API Gateway. YARP is maintained by Microsoft and is actively being developed and seems a better alternative than Ocelot and provides the same feature stack and even more.
You can read the Migrating to YARP documentation for migrating your existing microservice application's API Gateway from Ocelot to YARP.
We have made the all related changes in the Microservice Startup Template, and also updated the documentation, which you can read here. https://abp.io/docs/commercial/8.0/startup-templates/microservice/gateways
https://abp.io/community/articles/abp.io-platform-8.0-rc-has-been-published-3d8z8i16#switch-ocelot-to-yarp-for-the-api-gateway&gsc.tab=0
Is your project a microservice?
Thanks.
hi
Can you share an online URL?
liming.ma@volosoft.com
Thanks.
hi
Can you try this? https://abp.io/support/questions/10483/v1010-Tiered-Empty-grantedPolicies-in-WebPublic-MVC-when-CmsKit-is-enabled#answer-3a1fc36a-b259-117e-907a-2687f3b22102
Can you remove the CMS module to see if this is fixed?
//typeof(CmsKitProPublicWebModule)
Thanks.
hi
Can you share a demo app to reproduce the problem locally?
I will download and check it.
liming.ma@volosoft.com
Thanks.
hi
Can you also override the ICachedApplicationConfigurationClient and test again?
using System;
using System.Globalization;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Threading;
using Volo.Abp.Users;
namespace My.Web.Public;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ICachedApplicationConfigurationClient))]
public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency
{
private const string HttpContextItemsCacheKeyFormat = "ApplicationConfigurationDto_{0}_{1}_CacheKey";
protected IHttpContextAccessor HttpContextAccessor { get; }
protected AbpApplicationConfigurationClientProxy ApplicationConfigurationAppService { get; }
protected AbpApplicationLocalizationClientProxy ApplicationLocalizationClientProxy { get; }
protected ICurrentUser CurrentUser { get; }
protected MvcCachedApplicationConfigurationClientHelper CacheHelper { get; }
protected IDistributedCache<ApplicationConfigurationDto> Cache { get; }
protected AbpAspNetCoreMvcClientCacheOptions Options { get; }
public MvcCachedApplicationConfigurationClient(
MvcCachedApplicationConfigurationClientHelper cacheHelper,
IDistributedCache<ApplicationConfigurationDto> cache,
AbpApplicationConfigurationClientProxy applicationConfigurationAppService,
ICurrentUser currentUser,
IHttpContextAccessor httpContextAccessor,
AbpApplicationLocalizationClientProxy applicationLocalizationClientProxy,
IOptions<AbpAspNetCoreMvcClientCacheOptions> options)
{
ApplicationConfigurationAppService = applicationConfigurationAppService;
CurrentUser = currentUser;
HttpContextAccessor = httpContextAccessor;
ApplicationLocalizationClientProxy = applicationLocalizationClientProxy;
Options = options.Value;
CacheHelper = cacheHelper;
Cache = cache;
}
public virtual async Task<ApplicationConfigurationDto> GetAsync()
{
string? cacheKey = null;
var httpContext = HttpContextAccessor?.HttpContext;
var itemsKey = GetHttpContextItemsCacheKey();
if (httpContext != null && httpContext.Items[itemsKey] is string key)
{
cacheKey = key;
}
if (cacheKey.IsNullOrWhiteSpace())
{
cacheKey = await CreateCacheKeyAsync();
if (httpContext != null)
{
httpContext.Items[itemsKey] = cacheKey;
}
}
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{
return configuration;
}
configuration = (await Cache.GetOrAddAsync(
cacheKey,
async () => await GetRemoteConfigurationAsync(),
() => new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = Options.ApplicationConfigurationDtoCacheAbsoluteExpiration
}
))!;
if (httpContext != null)
{
httpContext.Items[cacheKey] = configuration;
}
return configuration;
}
private async Task<ApplicationConfigurationDto> GetRemoteConfigurationAsync()
{
var config = await ApplicationConfigurationAppService.GetAsync(
new ApplicationConfigurationRequestOptions
{
IncludeLocalizationResources = false
}
);
var localizationDto = await ApplicationLocalizationClientProxy.GetAsync(
new ApplicationLocalizationRequestDto {
CultureName = config.Localization.CurrentCulture.Name,
OnlyDynamics = true
}
);
config.Localization.Resources = localizationDto.Resources;
return config;
}
public ApplicationConfigurationDto Get()
{
string? cacheKey = null;
var httpContext = HttpContextAccessor?.HttpContext;
var itemsKey = GetHttpContextItemsCacheKey();
if (httpContext != null && httpContext.Items[itemsKey] is string key)
{
cacheKey = key;
}
if (cacheKey.IsNullOrWhiteSpace())
{
cacheKey = AsyncHelper.RunSync(CreateCacheKeyAsync);
if (httpContext != null)
{
httpContext.Items[itemsKey] = cacheKey;
}
}
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{
return configuration;
}
return AsyncHelper.RunSync(GetAsync);
}
protected virtual async Task<string> CreateCacheKeyAsync()
{
return await CacheHelper.CreateCacheKeyAsync(CurrentUser.Id);
}
protected virtual string GetHttpContextItemsCacheKey()
{
return string.Format(CultureInfo.InvariantCulture, HttpContextItemsCacheKeyFormat, CurrentUser.Id?.ToString("N") ?? "Anonymous", CultureInfo.CurrentUICulture.Name);
}
}
We make the same changes on https://github.com/abpframework/abp/pull/24990
Thanks.