Ensure Hangfire is always running in ASP.NET 5

I am using Hangfire in ASP.NET 5 and want to ensure Hangire always run following this doc: Making ASP.NET application always running
But in ASP.NET 5, it doesn’t have Global.asax.cs file so I don’t know how to implement it.
Could everyone please help me on this?

No one could help this issue :frowning:

I have Global.asax file (ASP NET Web API 2) and also Startup.cs but after following this tutorial I get error
`A route named ‘HelpPage_Default’ is already in the route collection. Route names must be unique.
Parameter name: name Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: A route named ‘HelpPage_Default’ is already in the route collection. Route names must be unique.
Parameter name: name

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[ArgumentException: A route named ‘HelpPage_Default’ is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.Routing.RouteCollection.Add(String name, RouteBase item) +3713529
System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults, Object constraints, String[] namespaces) +350
System.Web.Mvc.AreaRegistrationContext.MapRoute(String name, String url, Object defaults, Object constraints, String[] namespaces) +95
SpedimexApi.Areas.HelpPage.HelpPageAreaRegistration.RegisterArea(AreaRegistrationContext context) +174
System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state) +323
Api.WebApiApplication.Application_Start() +23

[HttpException (0x80004005): A route named ‘HelpPage_Default’ is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12601933
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): A route named ‘HelpPage_Default’ is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12618980
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12458597
`
So there is something wrong in my code.
I think I will use ping method to make my app always running.

Firstly I think ping is quite dumb way but now only it works. So just use until find another solution.

This error was made not by Hangfire. A have fixed it.
Are you using IIS 8.X ? There is new feature included that can enable always on application.
See: http://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET-Apps-alive