Hangfire MySqlStorage - HttpConfiguration does not contain a definition for 'UseStorage'

1.2k Views Asked by At

I'm trying to use Hangfire MySqlStorage in Web API app with mysql DB. I installed NuGet package "Hangfire.MySqlStorage" version 1.0.3. When I'm configuring Hangfire I'm getting following error,

HttpConfiguration does not contain a definition for 'UseStorage' and no extension method 'UseStorage' accepting a first argument of type 'HttpConfiguration' could be found (are you missing a using directive or an assembly reference?)

Seems I'm missing a reference here. Could not figure out.

1

There are 1 best solutions below

1
On BEST ANSWER

It seems you are calling the method on the wrong object.

It should be, as per the documentation:

GlobalConfiguration.Configuration.UseStorage(
    new MySqlStorage(connectionString));

Where GlobalConfiguration is actually Hangfire.GlobalConfiguration from the Hangfire.Core library.