简体   繁体   中英

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 !

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM