Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Autostart #2341


User avatar
0
easyest created

With application pool configured, application stays always on and background jobs (no Hangfire) are running. But after IIS restart application is not started. Is there a way to start application after IIS starts?


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I'm not experienced on this but have you tried to set "Start Mode" of your app pool to "AlwaysRunning" ? It might help.

  • User Avatar
    0
    easyest created

    That is done and application is always running. It just does not start after IIS restart.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is this only happens with AspNet Zero website ? Does any of your other websites starts after IIS restart ?

    I'm asking for getting a clue.

    Thanks.

  • User Avatar
    0
    easyest created

    There was no need to auto-start any of our products in this way - we do create windows services for background tasks.

    Google gives enough results for auto-start of an application, but it always mentions "serviceAutoStartProvider". My first thought was to create such class and run ABP bootstrap procedure like Your console application example. But what will happen when the bootstrap procedure will be started once again from global.asax?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    As I said before, I don't have any knowledge on this issue. But in this approach startup code will run twice and probably you will get exceptions but I'm not %100 sure about this.

    Maybe it is better to make a fake request to website after iis restart. This doc says that you can do it if you are using IIS8 <a class="postlink" href="https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization">https://www.iis.net/learn/get-started/w ... ialization</a>.

    Search for "preloadEnabled" keyword in this doc. from the doc:

    Setting preloadEnabled to "true" tells IIS 8.0 that it sends a "fake" request to the application when the associated application pool starts up. That is why in the previous step we set the application pool's startMode to "AlwaysRunning".