title: With AbortOnConnectFail set to false, we still get ConnectTimeout on Azure REDIS
body: <p>We incidentally receive the following error logs in our .NET Core 2.0 Azure App Service:</p>
  
  <pre><code>StackExchange.Redis.RedisConnectionException: No connection is available to service this operation: GET post:307948:media;
  It was not possible to connect to the redis server(s). 
  To create a disconnected multiplexer, disable AbortOnConnectFail. 
  ConnectTimeout; IOCP: (Busy=0,Free=1000,Min=4,Max=1000), 
  WORKER: (Busy=20,Free=662,Min=4,Max=682), 
  Local-CPU: n/a ---&gt; System.AggregateException: One or more errors occurred. 
  (It was not possible to connect to the redis server(s). 
  To create a disconnected multiplexer, disable AbortOnConnectFail. ConnectTimeout) 
  (UnableToConnect on api-prod.redis.cache.windows.net:6380/Interactive, 
  Initializing, last: NONE, 
  origin: BeginConnectAsync, outstanding: 0, last-read: 12s ago, last-write: 12s ago, 
  unanswered-write: 290293s ago, keep-alive: 60s, 
  state: Connecting, mgr: 10 of 10 available, 
  last-heartbeat: never, global: 0s ago, v: 2.0.513.63329)
  </code></pre>
  
  <p>All the answers and blog posts I've found, tell us to set the property <strong>AbortOnConnectFail</strong> to false. We already have this property set to false, and still these errors occur. Here is our implementation:</p>
  
  <pre><code>public class CacheService : ICacheService
      {
          private static IRedisConfiguration _redisConfiguration;
          private readonly IDateService _dateService;
  
          private static readonly Lazy&lt;ConnectionMultiplexer&gt; LazyConnection =
              new Lazy&lt;ConnectionMultiplexer&gt;(() =&gt;
              {
                  var configurationOptions = CreateConfigurationOptions();
                  return ConnectionMultiplexer.Connect(configurationOptions);
              });
  
          public CacheService(IRedisConfiguration redisConfiguration, IDateService dateService)
          {
              _redisConfiguration = redisConfiguration;
              _dateService = dateService;
          }
  
          private static ConfigurationOptions CreateConfigurationOptions()
          {
              var deltaBackOffInMilliseconds = TimeSpan.FromSeconds(5).Milliseconds;
              var maxDeltaBackOffInMilliseconds = TimeSpan.FromSeconds(20).Milliseconds;
  
              var config = new ConfigurationOptions();
  
              //https://docs.microsoft.com/en-us/azure/architecture/best-practices/retry-service-specific#azure-redis-cache-retry-guidelines
              config.AbortOnConnectFail = false;
              config.ConnectRetry = 3;
              config.ConnectTimeout = 2000;
              config.ReconnectRetryPolicy = new ExponentialRetry(deltaBackOffInMilliseconds, maxDeltaBackOffInMilliseconds);
  
              config.EndPoints.Add(_redisConfiguration.HostName);
              config.Password = _redisConfiguration.Password;
              config.Ssl = _redisConfiguration.Ssl;
              config.DefaultDatabase = _redisConfiguration.DatabaseId;
  
              return config;
          }
  
          public static ConnectionMultiplexer Connection =&gt; LazyConnection.Value;
  
          public static IDatabase Cache =&gt; Connection.GetDatabase();
  }
  </code></pre>
  
  <p>On the Azure App service I've checked the TCP connections, and no warnings are shown. There was an increase of <strong>outgoing connections</strong>, but it was below 1000.</p>
  
  <p>With two instances of the API running, we have about 80 connections, almost constant. No increase over the day, so it seams connection management seems right.</p>
  
  <p>Any tips on how to resolve this? Perhaps it's due to some more configuration tweaks.</p>
  
  <p>Azure Redis: P1 Premium tier
  StackExchange.Redis version: 2.0.513
  .NET Core API running on .NET Core 2.0</p>
  
  <p>Many thanks in advance.</p>