Hangfire JobStore runs well on SQLServer 2008 R2 in VMWare Fusion 7 Pro in OSX Mavericks, hosting a Windows 7 Pro Hangfire App. I want to replace SQLServer with Redis running in OSX Mavericks. Regis 2.8.17 is running in IP xx.x.x.xx Port 6379. (MongoDB is also running on IP xx.x.x.xx but Port 4142 and is shared nicely with Windows VMs in the same OSX host. When I change the JobStore to Redis, all works well until I enqueue the job, at which time Hangfire creates the DB Tables if they don’t already exist. However, at DBTable create time, Redis throws the exception: “invalid DB index, sPort: 0, LastCommand:”. I show Redis code snippets below. This works well for SQLServer (Startup.UseRedisAsJobStorageServer = false) but fails for Redis (Startup.UseRedisAsJobStorageServer = true). What am I doing wrong?
if (Startup.UseRedisAsJobStorageServer)
{
JobStorage.Current = new RedisStorage(Startup.RedisIP, Startup.RedisPort);
}
else
{
JobStorage.Current = new SqlServerStorage(Startup.SQLServerConnectionstring);
}
.....
Startup.app.UseHangfire(config =>
{
config.UseAuthorizationFilters();
if (Startup.UseRedisAsJobStorageServer)
{
config.UseRedisStorage(Startup.RedisIP, Startup.RedisPort);
}
else
{
config.UseSqlServerStorage(Startup.SQLServerConnectionstring);
}
......
BackgroundJob.Enqueue(() => KESConsoleRunner.Program.ExecuteBackgroundJob(RunString, Startup.server.Instance.Address.ToString(), Startup.SQLServerConnectionstring));
}