ServiceStack.Redis:无法连接:sPort:0 [英] ServiceStack.Redis: Unable to Connect: sPort: 0

查看:58
本文介绍了ServiceStack.Redis:无法连接:sPort:0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时(并非总是)我得到

无法连接:sPort:0"

在使用 ServiceStack.Redis 时尝试从 Redis 获取值时出错.有谁知道这可能意味着什么?我正在使用 PooledRedisClientManager 来获取客户端.

解决方案

我相信您可以通过增加池的 ConnectTimeout 来解决这个问题.我将它设置得非常低(10 毫秒),因此在创建池时,一些客户端在短时间内无法连接.如果池返回这些客户端之一,它会抛出这个错误(0"端口是因为它没有连接——它不知道它没有连接到哪个端口).延迟后,所有客户端都可以连接.

我将连接超时增加到 500 毫秒,问题就消失了——客户端都连接了,尽管其中一些客户端阻塞了几百毫秒.但这总比错误要好得多.

Sometimes (not always) I am getting

"Unable to Connect: sPort: 0"

error when trying to get value from Redis when using ServiceStack.Redis. Does anyone know what that might mean? I am using PooledRedisClientManager to get the client.

解决方案

I believe you can fix this by increasing the pool's ConnectTimeout. I had it set very low (10ms), so when the pool was created, some of the clients were unable to connect in that short period. If the pool returned one of these clients, it would throw this error (the "0" port is because it's not connected -- it doesn't know what port it's not connected to). After a delay, all of the clients are able to connect.

I increased my connect timeout to 500ms, and the problem went away -- the clients all connect, though some of them block for a couple hundred milliseconds. But that's much better than an error.

这篇关于ServiceStack.Redis:无法连接:sPort:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆