Open Closed

Unable to connect to redis server(S) #848


User avatar
0
nhontran created
  • ABP Framework version: v3.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi, I have set the redis cache to false in appsettings.json. However, I still got this error when deploying the API into UAT server, this issue does not happen in localhost.

appsettings.json:

  "Redis": {
    "Configuration": "127.0.0.1",
    "IsEnabled": "false"
  },

Error:

Volo.Abp.AbpInitializationException: An error occurred during ConfigureServices phase of the module SingHealth.DigitalPlatform.DigitalPlatformHttpApiHostModule, SingHealth.DigitalPlatform.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 1s ago, last-write: 1s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 6s ago, v: 2.0.593.37019
   at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 942

20 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    It may be that different environments use wrong appsettings.json.

  • User Avatar
    0
    nhontran created

    Hi @maliming, I thought about that at first, so I have set the "IsEnabled": "false" for all the setting files, I also tried to delete all the appsettings and left the appsetings.json -> also got the same issue

  • User Avatar
    0
    nhontran created

    I tested again in my localhost with deployment in IIS, the same issue happens. It only works fine if we run it on IIS Express using visual studio.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can I check your souce code remotely?

  • User Avatar
    0
    nhontran created

    Hi @maliming, sorry, can we have a call at the other time? how abt 02:00PM GMT+8?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    OK. 02:00PM GMT+8 is ok.

  • User Avatar
    0
    nhontran created

    Hi @maliming, noted, thanks

  • User Avatar
    0
    nhontran created

    Hi @maliming, so sorry, I am stuck in another urgent request meeting, can we rearrange the meeting to another time? please let me know your available time slots, I will tried to fit one of yours.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    My working hours are 9:00-18:00 UTC+8, You can leave message when you are free.

  • User Avatar
    0
    jurec created

    Abp: 4.2.1

    Hi there,

    The problem is that abp platform forces to use Redis in production mode. I belive this is a bug, or there is something else on that. Commenting lines are solved this issue for me (see the code below).

        private void ConfigureRedis(
            ServiceConfigurationContext context,
            IConfiguration configuration,
            IWebHostEnvironment hostingEnvironment)
        {
            if (!hostingEnvironment.IsDevelopment())
            {
                /*var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
                context.Services
                    .AddDataProtection()
                    .PersistKeysToStackExchangeRedis(redis, "edelivery2-Protection-Keys");*/
            }
        }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi jurec

    The tiered project needs the Redis.

    https://github.com/abpframework/abp/issues/5023#issuecomment-687854205

  • User Avatar
    0
    nhontran created

    Hi @maliming, why redis is mandatory for tiered project? this is not mentioned in the documentation:

    https://docs.abp.io/en/abp/latest/Redis-Cache

    if it is because of key storage provider, we can replace it by entity framework core, right?

    https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/implementation/key-storage-providers?view=aspnetcore-5.0&tabs=visual-studio

    please help check and confirm.

  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    why redis is mandatory for tiered project?

    Applications are using caching, such as caching query results, settings, permissions, etc., so we need to cache, especially tiered project.

  • User Avatar
    0
    nhontran created

    Hi @maliming, is it for performance purpose only? what if we are using tiered project and do not install the redis? I have replaced the data protection storage provider with EF core.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    If you don't use redis, the caches of multiple projects will be inconsistent and cause problems.

  • User Avatar
    0
    lan.dang created

    Hi here, I got the same problem when deploy application in test server. It works in local with IIS Express Visual Studio. What should I do to solve this issue?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi lan.dang Please create a new question.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

  • User Avatar
    1
    Jatinder.singh created

    Please help me to resolve this issue asap .

    Appsetting configuration.

    Error:-

    StackExchange.Redis.RedisConnectionException: 'It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 5s ago, v: 2.2.4.27433'

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi Jatinder.singh

    Please create a new question.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38