Sorry if I’m missing something obvious, but do you have to run in ASP.NET MVC
in order to have access to the dashboard? I thought that if I did:
void main(string[] args)
{
JobStorage.Current = new SqlServerStorage(@"<my info>");
using(var server = new BackgroundJobServer())
{
/* ... */
Console.ReadLine();
}
}
That the dashboard would be available somewhere. What obvious thing am I missing? Only when I started this from an ASP.NET MVC
project was I able to have access to it.
You are not required to run ASP.NET MVC. I just created a blog post about how to do this since I had the same problem!
http://frankouimette.com/tutorial-installing-hangfire-without-asp-net-mvc/
Gotcha. Thanks for your reply. I was looking at solely using console, but that makes sense that it can’t tap into the IIS asset pipeline if there’s no web server Currently I’m just going to have a web project that only serves the purpose of the dashboard.
I guess a simple yet better way instead of creating a new web project, spawn a new OWIN WebApp to self host,on startup of a windows service or a console application.
example:
protected static IDisposable WebApplication;
private static int Main(string[] args)
{
StartWebServer();
// start your windows service
}
public static void StartWebServer()
{
WebApplication = WebApp.Start<WebPipeline>("http://localhost:5000");
}
public static void StopWebserver()
{
WebApplication.Dispose();
}
public class WebPipeline
{
public void Configuration(IAppBuilder app)
{
app.UseHangfire(config =>
{
config.UseSqlServerStorage("<connection string or its name>");
config.UseServer();
});
}
}
}
More on owin:
@haricharan123, This is great as long as you have access to install such an app on the server. Otherwise you will need to rely upon IIS for all your needs.