title: Connection to Redis Servier via StackExchange.Redis
body: <p>I try to make a test project using the <a href="https://redis.io" rel="noreferrer">Redis</a> Server, installed on a Linux Ubuntu Virtual Machine, via a Virtual Box.</p>
  
  <p>The Linux machine is linked with the local network via the Virtual Box's Bridged Adapter, the Virtual Box running on my development Windows 7 Machine.</p>
  
  <p>The Linux Machine is a new one, just created, I did the </p>
  
  <pre><code>sudo ufw enable
  </code></pre>
  
  <p>and then restarted the redis server (on linux).</p>
  
  <p>Now here is my try from Windows</p>
  
  <pre><code>C:\Users\my-user&gt;nmap -p 6379 10.14.30.51
  Starting Nmap 7.70 ( https://nmap.org ) at ...
  Nmap scan report for 10.14.30.51
  Host is up (0.0010s latency).
  
  PORT     STATE    SERVICE
  6379/tcp filtered redis
  MAC Address: 08:00:27:98:94:49 (Oracle VirtualBox virtual NIC)
  </code></pre>
  
  <p>I created a new .NET MVC project with my Visual Studio 2017, and here is the controller's code:</p>
  
  <pre><code>using StackExchange.Redis;
  using System.Web.Mvc;
  
  namespace RedisClient.Controllers
  {
      public class HomeController : Controller
      {
          public struct Server {
              public const string IP = "10.14.30.51";
              public const int Port = 6379;
          }
  
          public ActionResult Index() { return View(); }
  
          public ActionResult About()
          {            
              ConnectionMultiplexer redis = 
                  ConnectionMultiplexer.Connect($"{Server.IP}:{Server.Port}"); 
  
              IDatabase db = redis.GetDatabase();
              string value = "abcdefg";
              db.StringSet("mykey", value);
              value = db.StringGet("mykey");
  
              ViewBag.Message = $"The value is '{value}'";
  
              return View();
          }
  
          public ActionResult Contact() { return View(); }
      }
  }
  </code></pre>
  
  <p>So, when I click on the "About" link I obtain the following error on the <code>.Connect</code> line</p>
  
  <blockquote>
    <p>It was not possible to connect to the redis server(s). UnableToConnect
    on 10.14.30.51: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: 0s ago, v: 2.0.601.3402</p>
  </blockquote>
  
  <p><strong>--EDIT</strong></p>
  
  <p>The output of </p>
  
  <pre><code>var log = new StringWriter();
  
  ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(
      $"{Server.IP}:{Server.Port},abortConnect=False", log);
  var logOutput = log.ToString();
  </code></pre>
  
  <p>is the following:</p>
  
  <pre><code>10.14.30.51:6379,abortConnect=False
  
  Connecting 10.14.30.51:6379/Interactive...
  BeginConnect: 10.14.30.51:6379
  1 unique nodes specified
  Requesting tie-break from 10.14.30.51:6379 &gt; __Booksleeve_TieBreak...
  Allowing endpoints 00:00:05 to respond...
  Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=1,Free=8190,Min=4,Max=8191)
  Not all tasks completed cleanly (from ReconfigureAsync#1524, timeout 5000ms), IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=4,Free=8187,Min=4,Max=8191)
  10.14.30.51:6379 did not respond
  Waiting for tiebreakers...
  Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=4,Free=8187,Min=4,Max=8191)
  connection failed: 10.14.30.51:6379 (Subscription, UnableToConnect): UnableToConnect on 10.14.30.51:6379/Subscription, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402
  connection failed: 10.14.30.51:6379 (Interactive, UnableToConnect): UnableToConnect on 10.14.30.51:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402
  Finished awaiting tasks, IOCP: (Busy=2,Free=998,Min=4,Max=1000), WORKER: (Busy=4,Free=8187,Min=4,Max=8191)
  10.14.30.51:6379 failed to nominate (Faulted)
  &gt; UnableToConnect on 10.14.30.51:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402
  No masters detected
  10.14.30.51:6379: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Connecting; sub: Connecting; not in use: DidNotRespond
  10.14.30.51:6379: int ops=0, qu=0, qs=0, qc=0, wr=0, socks=2; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=2
  Circular op-count snapshot; int: 0 (0,00 ops/s; spans 10s); sub: 0 (0,00 ops/s; spans 10s)
  Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
  resetting failing connections to retry...
  retrying; attempts left: 2...
  1 unique nodes specified
  Requesting tie-break from 10.14.30.51:6379 &gt; __Booksleeve_TieBreak...
  Allowing endpoints 00:00:05 to respond...
  Awaiting task completion, IOCP: (Busy=1,Free=999,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  Not all tasks completed cleanly (from ReconfigureAsync#1524, timeout 5000ms), IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  10.14.30.51:6379 did not respond
  Waiting for tiebreakers...
  Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  Not all tasks completed cleanly (from NominatePreferredMaster#1761, timeout 50ms), IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  10.14.30.51:6379 failed to nominate (WaitingForActivation)
  No masters detected
  10.14.30.51:6379: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Disconnected; sub: Disconnected; not in use: DidNotRespond
  10.14.30.51:6379: int ops=0, qu=0, qs=0, qc=0, wr=0, socks=2; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=2
  Circular op-count snapshot; int: 0 (0,00 ops/s; spans 10s); sub: 0 (0,00 ops/s; spans 10s)
  Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
  resetting failing connections to retry...
  retrying; attempts left: 1...
  1 unique nodes specified
  Requesting tie-break from 10.14.30.51:6379 &gt; __Booksleeve_TieBreak...
  Allowing endpoints 00:00:05 to respond...
  Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  Not all tasks completed cleanly (from ReconfigureAsync#1524, timeout 5000ms), IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=5,Free=8186,Min=4,Max=8191)
  10.14.30.51:6379 did not respond
  Waiting for tiebreakers...
  Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=5,Free=8186,Min=4,Max=8191)
  Finished awaiting tasks, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
  10.14.30.51:6379 failed to nominate (Faulted)
  &gt; UnableToConnect on 10.14.30.51:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 10s ago, v: 2.0.601.3402
  No masters detected
  10.14.30.51:6379: Standalone v2.0.0, master; keep-alive: 00:01:00; int: Disconnected; sub: Disconnected; not in use: DidNotRespond
  10.14.30.51:6379: int ops=0, qu=0, qs=0, qc=0, wr=0, socks=3; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=3
  Circular op-count snapshot; int: 0 (0,00 ops/s; spans 10s); sub: 0 (0,00 ops/s; spans 10s)
  Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
  Starting heartbeat...
  </code></pre>
  
  <p>==References</p>
  
  <p>In my .csproj file I have, among others</p>
  
  <pre><code>&lt;Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"&gt;
    &lt;HintPath&gt;..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll&lt;/HintPath&gt;
  &lt;/Reference&gt;
  ...
  &lt;Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"&gt;
    &lt;HintPath&gt;..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll&lt;/HintPath&gt;
  &lt;/Reference&gt;
  ...
  &lt;Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"&gt;
    &lt;HintPath&gt;..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll&lt;/HintPath&gt;
  &lt;/Reference&gt;
  </code></pre>
  
  <p><strong>The related <a href="https://superuser.com/q/1435346/465922">SuperUser question with another details is here</a>.</strong></p>
  
  <p>Windows:
  <a href="https://i.stack.imgur.com/GEc77.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GEc77.png" alt="enter image description here"></a></p>
  
  <p>Linux:
  <a href="https://i.stack.imgur.com/aedas.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aedas.png" alt="enter image description here"></a></p>