redis - PooledRedisClientManager 抛出 Appharbor Redis URL

标签 redis servicestack appharbor

我正在 MVC4 应用程序中的 Appharbor 上试用 Redis。我正在使用 ServiceStack C# client for Redis .使用 ServiceStack.Redis 中的 RedisClient 时一切正常。但是,因为我只打算使用 Redis 进行缓存,所以我尝试连接 ServiceStack 作为包装器提供的 ICacheClient。这是我的 StructureMap 配置 ( https://github.com/ServiceStack/ServiceStack/wiki/Caching ):

x.For<IRedisClientsManager>().Use(() => new PooledRedisClientManager(redisUrl));
x.For<ICacheClient>().Use(c => c.GetInstance<IRedisClientsManager>().GetCacheClient());

我的问题是当我使用 Appharbor 提供的 Redis-to-Go URL 时,PooledRedisClientManager 抛出错误,“input string was not in a correct format” .这是它的样子:

redis://redistogo-appharbor:abunchofrandomcharacters@drum.redistogo.com:9081/

如果我用 localhost:5051 替换 Redis-to-Go URL,一切正常。 我错过了什么?

最佳答案

前缀 redis:// 不是任何已知的 redis 约定 - 它必须是 RedisToGo 或 AppHarbor 约定。

ServiceStack 的 C# RedisClient 支持标准的“password@host:port”约定,例如:

container.Register(c => new PooledRedisClientManager(
    "redistogo-appharbor:abunchofrandomcharacters@drum.redistogo.com:9081"
));

关于redis - PooledRedisClientManager 抛出 Appharbor Redis URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12205858/

相关文章:

python - Redis:获取所有哈希值的最佳方式

Servicestack ORMLite 查询多个

C#.net Web 请求在调用 Web API 时无法获取 404 自定义错误消息,但 postman 却可以

hash - ServiceStack Entities Id 字段名称

umbraco - 在 appharbor 上设置 CMS 有多容易

java - spring boot redis starter 获取错误字符串超出最大允许大小 (512MB)

java - 在 redis 中保存 Set<String> 的 Value 的序列化程序

asp.net-mvc-3 - 为什么 AppHarbor + RequireHttpsAttribute 等于 frowny-face :(

mysql - 在 AppHarbour 中托管 MVC 应用程序

php - 在 PHP/Redis 上缓存标记有好的解决方案吗?