Redis Docker Container Error ArgumentException: No endpoints specified (Parameter 'configuration')

Question: How do you solve the error that comes when you are trying to cache an object to Redis and the error says "ArgumentException: No endpoints specified (Parameter 'configuration')".

Answer: When working with Redis Docker Container in Asp.Net 5 Application, in order to connect to the external Redis Cache Server you will need to provide the Configuration Settings. The ConfigurationOptions requires the Endpoints to have two parameters, one is for the IP Address (Just IP Address, do not include HTTP or HTTPS) and the other one is for the port. Make sure you put all these settings in the appsettings.json and use the IConfiguration Interface to get the values from the file.

See the code below:

            services.AddDistributedMemoryCache();
            services.AddStackExchangeRedisCache(options =>
            {
            options.InstanceName = _configuration.GetValue<string>("NameOfInstanceHere");
            options.ConfigurationOptions = new ConfigurationOptions()
            {
                EndPoints = { { _configuration.GetValue<string>("SettingsBlock:ConnectionString"), PortNumberComesInHere } },
                ConnectRetry = 2,
                ReconnectRetryPolicy = new LinearRetry(10),
                //Ssl = true,
                //AbortOnConnectFail = false,
                ConnectTimeout = 5000,
                //SyncTimeout = 1000,
                DefaultDatabase = 0,
                 Password = _configuration.GetValue<string>("Password")
            };



        });



Redis Distributed Caching Asp.net 5 Docker Docker published

Was this page helpful?

Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
Login to Continue

Community of Software Developers

Welcome, log in to continue reading. It's free and only takes a minute.




© 2020 - ErnesTech - Privacy