I am coding a MVC 5 internet application, and am wishing to use Hangfire
for recurring tasks.
How can I setup Hangfire
to use SQL Server storage
without specifying this in the Startup.Auth
ConfigureAuth(IAppBuilder app)
function.
Here is a resource link for SQL Server configuration: Using SQL Server β Hangfire Documentation
This resource states that:
If you want to use Hangfire outside of web application, where OWIN
Startup class is not applicable, create an instance of the
SqlServerStorage manually and pass it to the JobStorage.Current static
property. Parameters are the same.
The example code is as follows:
JobStorage.Current = new SqlServerStorage("connection string or its name");
I have tried the following code (with my own connection string), yet the dashboard is not available. I have called the code above from a controller function.
Is there something that I have not done correct? How can I setup Hangfire
to use SQL Server storage
without using the Startup.Auth
class?
Thanks in advance.