Reputation: 263
I have a scheduler service written in MVC web application. I set the AutoStart
to TRUE
and StartMode
to AlwaysRunning
in IIS.
I am expecting that when IIS started the code written in Global.asax Application_Start()
event should get executed automatically. But it is not happening, it is executing only when I hit the URL of that virtual directory in browser.
Thank you.
Upvotes: 1
Views: 1105
Reputation: 249
Application_Start only fires when the application is first initializated, which only occurs on first call to the URL, not on AppPool start.
There are some modules for IIS7.5+ to allow auto initialization, you can find more details here: Run Application_Start immediately when application pool restarts in IIS
Upvotes: 1