hi
but the code in that example doesn't work in Azure Functions
Are there any errors or anything?
Please share the logs of AuthServer when you get 400.
hi
You can override the application service in the module without source code.
https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Guide
hi
I downloaded your project and inserted data into postgres DocsProjects table.
INSERT INTO public."DocsProjects" ("Id", "Name", "ShortName", "Format", "DefaultDocumentName", "NavigationDocumentName", "ParametersDocumentName", "MinimumVersion", "DocumentStoreType", "MainWebsiteUrl", "LatestVersionBranchName", "ExtraProperties", "ConcurrencyStamp") VALUES ('12f21123-e08e-4f15-bedb-ae0b2d939658', 'ABP framework (GitHub)', 'abp', 'md', 'Index', 'docs-nav.json', '', null, 'GitHub', '/', 'dev', '{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"","GitHubUserAgent":""}', null);
hi
Can you try to create a new template project and test it?
hi
You are using 6.0
Add MyMvcCachedApplicationConfigurationClient class. set AbsoluteExpirationRelativeToNow = TimeSpan.Zero
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Distributed;
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 MyCompanyName.MyProjectName.Web;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ICachedApplicationConfigurationClient), typeof(MyMvcCachedApplicationConfigurationClient))]
public class MyMvcCachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency
{
protected IHttpContextAccessor HttpContextAccessor { get; }
protected AbpApplicationConfigurationClientProxy ApplicationConfigurationAppService { get; }
protected ICurrentUser CurrentUser { get; }
protected IDistributedCache<ApplicationConfigurationDto> Cache { get; }
public MyMvcCachedApplicationConfigurationClient(
IDistributedCache<ApplicationConfigurationDto> cache,
AbpApplicationConfigurationClientProxy applicationConfigurationAppService,
ICurrentUser currentUser,
IHttpContextAccessor httpContextAccessor)
{
ApplicationConfigurationAppService = applicationConfigurationAppService;
CurrentUser = currentUser;
HttpContextAccessor = httpContextAccessor;
Cache = cache;
}
public async Task<ApplicationConfigurationDto> GetAsync()
{
var cacheKey = CreateCacheKey();
var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{
return configuration;
}
configuration = await Cache.GetOrAddAsync(
cacheKey,
async () => await ApplicationConfigurationAppService.GetAsync(),
() => new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.Zero //TODO: Should be configurable.
}
);
if (httpContext != null)
{
httpContext.Items[cacheKey] = configuration;
}
return configuration;
}
public ApplicationConfigurationDto Get()
{
var cacheKey = CreateCacheKey();
var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{
return configuration;
}
return AsyncHelper.RunSync(GetAsync);
}
private string CreateCacheKey()
{
var userKey = CurrentUser.Id?.ToString("N") ?? "Anonymous";
return $"ApplicationConfiguration_{userKey}_{CultureInfo.CurrentUICulture.Name}";
}
}
hi
Can you test if changing ApplicationConfigurationDtoCacheAbsoluteExpiration works?
By the way change log level in all applications.
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAspNetCoreMvcClientCacheOptions>(options =>
{
options.ApplicationConfigurationDtoCacheAbsoluteExpiration = TimeSpan.Zero;
});
}
public class Program
{
public async static Task<int> Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console())
.CreateLogger();
hi
I suggest you create a latest template project of your same type and compare the code.
hi
Please share the POSTGRESQL project. liming.ma@volosoft.com