Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hangfire + ASP.NET MVC

This is my first time posting here.

I am currently writing an ASP.NET MVC application (using .NET 4.5.2 and MVC 5). I want to integrate Hangfire into my project. I have set up a side project which worked. But when I tried to integrate it into my main project, several errors occurred. They are:

  1. The .dll files had to be strong-named (I fixed this issue by using ildasm/ilasm to strong name them. I replace the original files that came with the nuget package.)

  2. After strong-naming and replacing the files, I ran into another error. When I tried to build and run the solution, a 'GlobalConfiguration' does not exists in the current context, and also a are you missing an assembly reference error is thrown.

I have tried various ways to solve this, but to no avail. I would really like some advice on this ! Thanks !


1 Answers

GlobalConfiguration is a class in the Hangfire namespace. You should import the namespace so that you can use it (and the extension methods it provides)

using Hangfire;

So now code like this will work:

GlobalConfiguration.Configuration.UseSqlServerStorage("MyConnectionString");
like image 74
DavidG Avatar answered Mar 11 '26 03:03

DavidG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!