this post was an eye opener,
Summary of my experience:
- if you are working on a console/windows service application.
The best option is to wrap the application with a “OWIN self-hosting” to host the dashboard/console.This keeps all refrences wrapped into one project, making sure the application that hosts the dashboard reference the assembly in which target method is defined.
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: