KJBTech
KJBTech

Reputation: 1971

Hangfire : The method UseSqlServerStorage is missing

I'm trying to install HangFire for a ASP.NET Code Project.

When I follow then official doc (https://www.hangfire.io/blog/2016/07/16/hangfire-1.6.0.html) or other link ressources (http://www.dotnetjalps.com/2017/04/aspnet-core-hangfire-integation.html), it's sounds clear. Add this

services.AddHangfire(config=>config.UseSqlServerStorage(Configuration.GetConnectionString("MyConnectionString")));

But it doesn't work. This extension method doesn't exist. Am I miss something ?

Upvotes: 0

Views: 5206

Answers (3)

Rod Caldas
Rod Caldas

Reputation: 56

I had a similar issue and it was caused because I already had GlobalConfiguration in my Startup and it was referencing System.Web.Http.GlobalConfiguration. Now I thought Hangfire would add this UseSqlServerStorage() as an extension method, like Swagger does for example, but instead Hangfire brings its own version of this file.

Referencing it directly worked for me:

Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage("connection_string");

Upvotes: 2

alif
alif

Reputation: 805

You might be missing the HangFire.SqlServer package. Once I added that to my project it worked. You can find the most recent version of the package here.

https://www.nuget.org/packages/HangFire.SqlServer/

Upvotes: 7

KJBTech
KJBTech

Reputation: 1971

So, I found the answser ..

I had to delete HangFire package, close my Visual Studio 2017 solution and clean the obj and bin folder.

Then, I reopen it, add HangFire.AspNetCore and HangFire.SQLServer packages. Then it works.

Upvotes: 4

Related Questions