Search code examples
redisservicestackappharbor

PooledRedisClientManager throws with Appharbor Redis URL


I am trying out Redis on Appharbor in an MVC4 application. I am using the ServiceStack C# client for Redis. Everything was working when using the RedisClient from ServiceStack.Redis. However, because I only plan to use Redis for caching, I attempted to wire up the ICacheClient that ServiceStack provides as a wrapper. Here is my StructureMap configuration (https://github.com/ServiceStack/ServiceStack/wiki/Caching):

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

My problem is that the PooledRedisClientManager is throwing error, "input string was not in a correct format" when I use the Redis-to-Go URL provided by Appharbor. Here is what that looks like:

redis://redistogo-appharbor:[email protected]:9081/

If I replace the Redis-to-Go URL with localhost:5051 everything works. What am I missing?


Solution

  • Prefixing a redis:// is not any known redis convention - it must be a RedisToGo or AppHarbor convention.

    ServiceStack's C# RedisClient supports standard "password@host:port" convention, e.g:

    container.Register(c => new PooledRedisClientManager(
        "redistogo-appharbor:[email protected]:9081"
    ));