Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时(并非总是)我得到
“无法连接:sPort:0”
使用 ServiceStack.Redis 时尝试从 Redis 获取值时出错。有谁知道这可能意味着什么?我正在使用 PooledRedisClientManager 来获取客户端。
我相信您可以通过增加池的ConnectTimeout. 我把它设置得非常低(10 毫秒),所以当创建池时,一些客户端在短时间内无法连接。如果池返回这些客户端之一,它会抛出这个错误(“0”端口是因为它没有连接——它不知道它没有连接到哪个端口)。延迟一段时间后,所有客户端都可以连接。
ConnectTimeout
我将连接超时增加到 500 毫秒,问题就消失了——客户端都连接了,尽管其中一些阻塞了几百毫秒。但这比错误要好得多。
这可能意味着端口号或主机地址错误。