Closed mkchandler closed 8 years ago
I've attempted changing to this:
var redis = new RedisStorage("host:port", new RedisStorageOptions { Db = 1 });
GlobalConfiguration.Configuration.UseStorage(redis);
app.UseHangfireDashboard();
app.UseHangfireServer();
But I cannot get it to work. I get the following exception:
[InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.]
Hangfire.JobStorage.get_Current() +170
Hangfire.AppBuilderExtensions.UseHangfireDashboard(IAppBuilder builder, String pathMatch, DashboardOptions options) +21
That's pretty strange! I've just setup a web application with the packages:
<package id="Hangfire.Core" version="1.4.6" targetFramework="net45" />
<package id="HangFire.Redis.StackExchange" version="1.4.7" targetFramework="net45" />
and startup:
public void Configuration(IAppBuilder app)
{
var storage = new RedisStorage("localhost:6379, allowAdmin=true", new RedisStorageOptions {Db = 3 });
GlobalConfiguration.Configuration.UseDashboardMetric(storage.GetDashboardMetricFromRedisInfo("Redis Version", RedisInfoKeys.redis_version));
GlobalConfiguration.Configuration.UseDashboardMetric(storage.GetDashboardMetricFromRedisInfo("Used Memory", RedisInfoKeys.used_memory_human));
GlobalConfiguration.Configuration.UseDashboardMetric(storage.GetDashboardMetricFromRedisInfo("Peak Memory", RedisInfoKeys.used_memory_peak_human));
GlobalConfiguration.Configuration.UseStorage(storage);
app.UseHangfireDashboard(string.Empty, new DashboardOptions() { AppPath="/", AuthorizationFilters=new IAuthorizationFilter[0]});
app.UseHangfireServer();
}
and it works smooth. What version of Hangfire.Core do you use ?
Any news on this ? Is it solved now ?
Sorry, I've been unexpectedly away from work and haven't had a chance to retest. Will do so as soon as I can. Thanks for the quick replies!
On Mon, Sep 14, 2015 at 3:01 AM Marco Casamento notifications@github.com wrote:
Any news on this ? Is it solved now ?
— Reply to this email directly or view it on GitHub https://github.com/marcoCasamento/Hangfire.Redis.StackExchange/issues/14#issuecomment-139990187 .
So it looks like this was being caused by something else, possibly something cached up in IIS. After coming back to it today, it is working... Ugh, hate when that happens :-) Thanks for your help and quick response.
I upgraded to the latest versions of Hangfire.Core and this library and am having a really hard time figuring out the new way to set up Hangfire with Redis. My previous code looked like this:
Hangfire now complains because the definition of
UseHangfireServer
has changed. I've tried following some of the documentation on Hangfire's site but none of it seems to work.Can you post a sample of how we should be setting up Hangfire to use Redis?
Versions via NuGet HangFire.Core:
1.4.6
HangFire.Redis.StackExchange:1.4.7