Hangfire Ace Downloads
Hangfire Ace packages are hosted on a private ProGet Server. Package downloads are available only for Hangfire Ace subscribers. After paying, you’ll instantly receive a link to download the Hangfire Ace binaries (non-NuGet based). Please give us 24 hours to generate your credentials for private NuGet server.
- Hangfire.Throttling – concurrency and rate limiting that don’t force your workers to wait.
There are several ways to add a NuGet feed, but the main difficulty is authentication. In modern environments with NuGet 3.5+ it is possible to use environment variables to provide credentials, and it is the best way, since you’ll have the same configuration for both development machines and build servers, and for all environments, including .NET Core projects.
Simple Setup in Visual Studio
This is the simplest way to start using Hangfire Ace feed, but it will not work with Continuous Integration. To configure a private feed in Visual Studio, open Tools → NuGet Package Manager → Package Manager Settings and add a new feed with the following URL:
Applies to: Visual Studio 2017, .NET Core CLI, NuGet.exe 3.5+. This will also work in Visual Studio 2015, but you’ll be prompted for credentials each time you install a package, when HangfireAce feed is selected.
Create a new file called
NuGet.config in the root directory of your solution, and add the following contents.
<!-- YourSolution\NuGet.config --> <configuration> <packageSources> <add key="HangfireAce" value="https://nuget.hangfire.io/nuget/hangfire-ace/" /> </packageSources> <packageSourceCredentials> <HangfireAce> <add key="Username" value="%HANGFIRE_LOGIN%" /> <add key="ClearTextPassword" value="%HANGFIRE_PASSWORD%" /> </HangfireAce> </packageSourceCredentials> </configuration>
The changes will take an effect only when you close the solution and re-open it. You can safely add this file to the solution control, since it does not contain any sensitive data. It’s better to set environment variables for credentials then, to not to specify them each time.
Setting environment variables
On Windows, use the
setx command to add the corresponding environment variables as shown below. Please note that these commands will add environment variables for all users and may require additional privileges, but you can remove the
/M switch to set them for current user only.
setx /M HANGFIRE_LOGIN your_login setx /M HANGFIRE_PASSWORD your_password
Alternatively you can set environment variables using the System properties window, but don’t forget to re-open the command prompt to use the new values.
On *nix systems it depends on your shell program. You can use the following commands to set environment variables when using Bash.
export HANGFIRE_LOGIN=your_login export HANGFIRE_PASSWORD=your_password
In TeamCity, use Build Parameters, in AppVeyor use secure variables in your
appveyor.yml file, in Travis CI it’s possible to use encrypted variables too. I believe other continuous integration servers also have an encryption feature.
Package not found: close the solution and open it again. 401 unauthorized status returned: ensure your environment variables are set and use correct credentials. If package restore prompts for credentials, ensure environment variables are set, and you have the latest version of the NuGet client:
> NuGet.exe help ... NuGet Version: 126.96.36.1996
If your version less than the specified one, just update the NuGet client:
NuGet.exe update -self
If you have any problems with the setup, send an email to firstname.lastname@example.org, I’ll be happy to help.
Build servers with NuGet < 3.5
Alternatively, you can run the following command to add a new package source using command line:
nuget sources add -Name "HangfireAce" -Source https://nuget.hangfire.io/nuget/hangfire-ace -UserName user -Password secret
After configuring private NuGet feed, use your favorite method to install Hangfire Ace NuGet packages.
Package Manager Console
The Package Manage Console can be opened in Visual Studio through
Library Package Manager →
Package Manager Console.
PM> Install-Package Hangfire.Throttling
Package Manager Dialog (Visual Studio)
- Right-click on your project and click “Manage NuGet Packages”.
- Select “NuGet Official Package Source”
- Search for “Hangfire”, using the search bar at the top right
- Select “Hangfire” and choose Install