Hangfire: Does not support net451

Created on 18 Aug 2016  路  2Comments  路  Source: HangfireIO/Hangfire

With one of my projects, I am still stuck using net451 because of other dependencies. I am unable to use Hangfire because it does not seem to be available.

// project.json
"dependencies": {
  ...
  "Hangfire": "1.6.2",
  ...
},
"frameworks": {
  "net451": {} 
}
// Startup.cs
using Hangfire; 
...
public void ConfigureServices(IServiceCollection services)
{
  // throws: 'IServiceCollection' does not contain a definition for 'AddHangfire' and no extension method 'AddHangfire' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
  services.AddHangfire(config =>
  {
    config.UseSqlServerStorage(Configuration["Database"]);
  });
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
  // throws:  'IApplicationBuilder' does not contain a definition for 'UseHangfireServer' and the best extension method overload 'AppBuilderExtensions.UseHangfireServer(IAppBuilder)' requires a receiver of type 'IAppBuilder'
  app.UseHangfireServer();
}

question

Most helpful comment

Have you tried to add Hangfire.AspNetCore package? I think it is not a part of Hangfire meta-package.

All 2 comments

Have you tried to add Hangfire.AspNetCore package? I think it is not a part of Hangfire meta-package.

Ahh yes that fixes the issue. I also needed to add Hangfire.SqlServer for my implementation case:

"Hangfire.AspNetCore": "1.6.2",
"Hangfire.SqlServer": "1.6.2"

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dbones picture dbones  路  3Comments

tompazourek picture tompazourek  路  3Comments

dgaspar picture dgaspar  路  4Comments

cindro picture cindro  路  3Comments

dealproc picture dealproc  路  3Comments