2

我一直在使用Enyim Memcached Client for .Net,试图连接到在AppHarbor上运行的服务器。我的配置文件的相关部分如下所示:

  <enyim.com>
    <log factory="Enyim.Caching.DiagnosticsLogFactory, Enyim.Caching" />
    <memcached protocol="Binary">
      <servers>
        <add address="8d593f28-37d7-4c4f-a702-aa7687a85ea1.memcacher.com" port="11211" />
      </servers>
      <authentication
          type="Enyim.Caching.Memcached.PlainTextAuthenticator, Enyim.Caching"
          userName="changed to post on stack overflow"
          password="changed to post on stack overflow"
          zone="AUTHZ"
              />
      </memcached>
    </enyim.com>

我的连接一直超时。有什么想法吗?以下是来自 Enyim 客户端的日志:

2012-01-21 18:56:08 [错误] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 无法初始化池。- System.TimeoutException:无法在 Enyim.Caching.Memcached.PooledSocket..ctor(IPEndPoint 端点,TimeSpan connectionTimeout, TimeSpan receiveTimeout) 在 Enyim.Caching.Memcached.MemcachedNode.CreateSocket() 在 Enyim.Caching.Memcached.Protocol.Binary.BinaryNode.CreateSocket() 在 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl.CreateSocket() 在 Enyim。 Caching.Memcached.MemcachedNode.InternalPoolImpl.InitPool() 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 请求将 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 - 标记节点 50.19。 210.46:11211 已死 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 InternalPoolImpl - FailurePolicy.ShouldFail(): True 2012-01-21 18:56:08 [WARN] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 将节点 50.19.210.46:11211 标记为已死 2012-01-21 18:56 :08 [调试] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 InternalPoolImpl - FailurePolicy.ShouldFail(): True 2012-01-21 18:56:08 [WARN] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 将节点 50.19.210.46:11211 标记为已死 2012-01-21 18:56 :08 [调试] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 MemcachedNode.InternalPoolImpl - 将节点 50.19.210.46:11211 标记为已死 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 MemcachedNode.InternalPoolImpl - 将节点 50.19.210.46:11211 标记为已死 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 节点 50.19.210.46:11211 已死。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211 Caching.Memcached.DefaultServerPool - 启动恢复计时器。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.DefaultServerPool - 计时器已启动。2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 从池中获取流。50.19.210.46:11211 2012-01-21 18:56:08 [DEBUG] 7 Enyim.Caching.Memcached.MemcachedNode.InternalPoolImpl - 池已死或已处置,返回 null。50.19.210.46:11211

更新:

原来我无法连接到 memcached 服务器的原因是因为它只能从 appharbor 的环境中访问。因此,对于遇到此问题的其他任何人,您需要在本地开发时使用本地 memcached 服务,然后在部署时简单地更改凭据(apphaorbor 实际上会自动为您执行)。问题已解决。

4

1 回答 1

4

AppHarbor Memcacher 存储桶只能从 AppHarbor 应用程序服务器访问。文档已被修改以清楚地反映这一点。

您应该使用本地安装的 memcached 服务器进行测试。

于 2012-01-22T09:14:03.753 回答