Base solution for your next web application
Open Closed

Issue with Delayed Updates to ABP Settings in Azure Deployment (AbpSettings Table) (Angular + ASPNET Core V12) #12177


User avatar
0
pliaspzero created

Dear ASPZERO Support,

We are encountering an issue with our Azure deployment - we use Angular + ASPNET Core ASPZERO V12:

In our application, we are using an Angular app with an ASP.NET Core API, along with the ABP Boilerplate and custom user-based settings stored in the AbpSettings table. In our on-premise environment, when we change settings via the UI, the updates are applied immediately.

However, in the Azure environment, where the Angular app and the ASP.NET Core Web API are deployed as separate App Services, changes to the AbpSettings table via the UI do not take effect immediately. We need to confirm the changes multiple times before they are actually reflected in the application.

Both environments are connected to SQL Server — one running locally, and the other using an Azure SQL Managed Instance.

Could this be due to caching, or do you have any insight into why the settings changes in the Azure environment are not immediately applied?

Thank you in advance for your support.


5 Answer(s)
  • User Avatar
    0
    pliaspzero created

    Could it be a problem with Instance count 2 in Azure - we are running 2 instances? With some caching issue?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @pliaspzero

    Yes, this is definitely related to multiple instances. I suggest you to check https://docs.aspnetzero.com/aspnet-core-angular/latest/Clustered-Environment

  • User Avatar
    0
    pliaspzero created

    Thank you! so solution would be to setup REdis Cache (in Azure) and ...

    Configuration.Caching.UseRedis(options => { options.ConnectionString = _appConfiguration["Abp:RedisCache:ConnectionString"]; options.DatabaseId = _appConfiguration.GetValue<int>("Abp:RedisCache:DatabaseId"); });

  • User Avatar
    0
    pliaspzero created

    Could it also be done like this?

    Clear Cache on Setting Change

    ABP Framework uses caching for settings to improve performance. If the cache is not cleared immediately after a setting is updated, one of the instances may continue using the outdated settings.
    

    To ensure the cache is cleared after saving changes, you should explicitly clear the cache after updating the ABP Settings. Here’s how you can handle cache invalidation programmatically after saving settings:

    csharp

    // Clear cache after settings are saved await _cacheManager.GetCache("AbpSettingsCache").ClearAsync();

    This ensures that the cache is cleared and both instances will load the updated settings from the database.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This will not work becuase each instance will use its own memory cache if you have multiple instances.