user1396423
user1396423

Reputation: 263

Start the web application as soon as IIS is started

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

Answers (1)

rualmar
rualmar

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

Related Questions