We left Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

Application pool stops

I’m trying to follow the instructions in the the “Enabling Service Auto-start” section to chage the applicationHost.config file (http://hangfire.readthedocs.org/en/latest/deployment-to-production/making-aspnet-app-always-running.html) after having rolled hangfire into production. I’m having trouble getting this part right:

  <add name="ApplicationPreload" type="MyApp.Web.ApplicationPreload, MyApp.Web" />

I have added the section immediately after (which follows immediately after )

The application pool simply stops (and I get a 503 error).
I think I’m not setting the type right, however I’m unsure how to figure the right syntax.

When I remove the section the application pool does not stop, and Hangfire works, however, I fear it will “not always run”.

How can I find the correct syntax for in my setting?


These kinds of errors are written to the windows event log. Please, look at Control Panel → Administration → Event Log, there should be a record with a more detailed description. Can you post it here?

Hi odinserj
I went through your guide once more and found I hadn’t implemented IProcessHostPreloadClient correctly in the ApplicationPreload class.

Your guide is correct and everything now works in production.


Okay, good to know. Could you tell me where was a mistake? Maybe we should highlight something that is easy to miss in the docs?

I literally missed " : System.Web.Hosting.IProcessHostPreloadClient" in “public class ApplicationPreload : System.Web.Hosting.IProcessHostPreloadClient” - ups

@mma, today I’ve made HangfireBootstrapper code more robust, please see the updated version of the Making ASP.NET application always running page.

Same issue with me. I’m trying to configure the application to be autostart with my own class. But i’m having difficulties trying to specify the class as there is not namespace. Even if I add the namespace I still face the same error as below (from Event Viewer in the server):

> *There was an error during processing of the managed application service auto-start for configuration path: 'MACHINE/WEBROOT/APPHOST/Default Web Site/App'. The error message returned is: 'An error occurred while executing Preload method.*
> *Exception: System.InvalidOperationException*
> *Message: An error occurred while trying to create preload provider 'WebSite5.ApplicationPreload,Default Web Site'.*
> *Exception: System.IO.FileNotFoundException*
> *Message: Could not load file or assembly 'Default Web Site' or one of its dependencies. The system cannot find the file specified.*

The add tag was added to the applicationHost config as below:

<add name="ApplicationPreload" type="WebSite5.ApplicationPreload,Default Web Site" />

However, the ApplicationPreload is implementing the IProcessHostPreloadClient. I believe the problem is with my tag.

I’m using .NET Framework 4.6.1 Web Forms