Using Hangfire in ASP.NET v4.0 WebForms project

Hi,
Good day!

I am trying to add Hangfire to an existing ASP.NET v4.0 WebForms project and receiving the following error (in the Nuget installation log screen):

Install failed. Rolling back…
Could not install package ‘Hangfire.Core 1.1.1’. You are trying to install this package into a project that targets ‘.NETFramework,Version=v4.0’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Points to note:

  1. The target project was initially based on .NET v3.5 and was migrated to v4.0 (more than 6 months ago).
  2. We do not have direct access to the internet on work PC, so I am downloading the Nuget packages and its dependencies for installation. Then I have setup an local folder as Nuget repository and installing from there.
  3. I have downloaded all the needed dependencies based on the “dependencies” list from the Nuget page, and based on the installation errors I received through the package manager log window.

And finally, I am not in a situation to use OWIN since I am planning to use Hangfire on a existing project without much changes. The purpose is mainly for the asyn report generation and storage of the same in database. It would be great if you can confirm if the following are the only things needed to be set in and WebForms project:

  1. Install package Hangfire.Core
  2. Install package Hangfire.SqlServer
  3. In Global.asax (Application_Start): JobStorage.Current = new SqlServerStorage("connection string or its name");
  4. Follow the rest as in the user guide?

Thanking you.

There is a nuget packet with (.net 4.0) use that instead and you should be good to go.

You can find the package in nuget.org

https://www.nuget.org/packages/Hangfire_net40/

Best,
Anis