title: Timeout Exception trying to connect to Memcached server on AppHarbor
body: <p>I've been using the <a href="https://github.com/enyim/EnyimMemcached" rel="nofollow">Enyim Memcached Client for .Net</a>, trying to connect to a server running on <a href="https://appharbor.com/" rel="nofollow">AppHarbor</a>. The relevant parts of my configuration file look like this:</p>
  
  <pre><code>  &lt;enyim.com&gt;
      &lt;log factory="Enyim.Caching.DiagnosticsLogFactory, Enyim.Caching" /&gt;
      &lt;memcached protocol="Binary"&gt;
        &lt;servers&gt;
          &lt;add address="8d593f28-37d7-4c4f-a702-aa7687a85ea1.memcacher.com" port="11211" /&gt;
        &lt;/servers&gt;
        &lt;authentication
            type="Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching"
            userName="changed to post on stack overflow"
            password="changed to post on stack overflow"
            zone="AUTHZ"
                /&gt;
        &lt;/memcached&gt;
      &lt;/enyim.com&gt;
  </code></pre>
  
  <p>My connection keeps timing out. Any ideas whats going on here? Here are the logs from Enyim client:</p>
  
  <p><em>2012-01-21 18:56:08 [ERROR] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Could not init pool. - System.TimeoutException: Could not connect to 50.19.210.46:11211
     at Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(Socket socket, IPEndPoint endpoint, Int32 timeout)
     at Enyim.Caching.Memcached.PooledSocket..ctor(IPEndPoint endpoint, TimeSpan connectionTimeout, TimeSpan receiveTimeout)
     at Enyim.Caching.Memcached.MemcachedNode.CreateSocket()
     at Enyim.Caching.Memcached.Protocol.Binary.BinaryNode.CreateSocket()
     at Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.CreateSocket()
     at Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.InitPool()
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Mark as dead was requested for 50.19.210.46:11211
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - FailurePolicy.ShouldFail(): True
  2012-01-21 18:56:08 [WARN] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Marking node 50.19.210.46:11211 as dead
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Node 50.19.210.46:11211 is dead.
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Starting the recovery timer.
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - Timer started.
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Acquiring stream from pool. 50.19.210.46:11211
  2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - Pool is dead or disposed, returning null. 50.19.210.46:11211</em></p>
  
  <p>UPDATE:</p>
  
  <p>Turns out the reason I can't connect to the memcached server is because it's only accessible from appharbor's environment. So for anyone else that runs across this, you need to use a local memcached service when developing locally, then simply change the credentials when deploying (which apphaorbor actually does automatically for you). Problem resolved.</p>