I have followed the documentation specified here to make the application always running and enable Service Auto-start. For configuration I used the documentation specified here and in this application I'm using Hangfire version 1.5.3. I have two other Hangfire applications running on the same server, one is using Hangfire v.1.4.1 and the other is using 1.4.5. Both of these work flawlessly. Every application runs under it's own application pool and there is no difference to the code.
The application that does not work adds a GUID after the port number as you can see in the pictures below. This application some times does not auto start and I think it has to do with the two server instances.
I know that Hangfire has modified something with ServerName because if you use "BackgroundJobServerOptions" and "ServerName" variable you get the obsolete message:
"Server Id is auto-generated now, and this option does not make sense anymore. Will be removed in 2.0.0."
Has anyone experienced this and managed to solve it?
Note: I'm not using BackgroundJobServerOptions in any of the applications and I have tried to reboot the server.
The two applications that work:
Found the problem. It seems that in version 1.5.3, probably 1.5 <, you should not use app.UseHangfireServer() in your OWIN Startup class if you have registered the application start in Global.asax as well. When I commented out the code like below everything started working again.
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
//GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
//app.UseHangfireServer();
}
}
Update:
I was following this tutorial:
http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html
Global.asax.cs:
protected void Application_Start(object sender, EventArgs e)
{
HangfireBootstrapper.Instance.Start();
}
protected void Application_End(object sender, EventArgs e)
{
HangfireBootstrapper.Instance.Stop();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With