Search code examples
iisschedulerecycle

How can I schedule a program to run whenever after iis recycle?


I need to run a program that warm up my app. Is there some way to schedule that whenever iis recycle?

I'm using IIS 7.5.


Solution

  • If you have a batchfile or exe that does the warming up you can schedule it as follows for a manual issreset

    execute on ONE single line on a commandprompt:

    schtasks /create 
             /tn warmup-app 
             /tr drive:\path\warmup.cmd 
             /sc ONEVENT 
             /EC System
             /MO *[System/EventID=3201]
    

    and if executed you're greeted with

    SUCCESS: The scheduled task "warmup-app" has successfully been created.

    Now configure IIS to log it's apppool restarts in the EventLog:

    enter image description here