9

Does the Application_Start in global.asax called when the new published code is kept in IIS web root for the project,

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
Sagar
  • 1,727
  • 4
  • 22
  • 30

2 Answers2

10

Application_Start triggers everytime the application pool is recycled which normally happens when you update some of the files in the bin folder or web.config. So if you republish your site and update some of those files IIS will unload the application and Application_Start will fire next time a request comes in.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • So can we a say that `Application_Start` triggers on a first request? – Sangram Nandkhile Nov 23 '17 at 16:31
  • @SangramNandkhile Correct, running the debugger, locally or remotely, verifies Application_Start is called the first time application is accessed after application pool is recycled (I am sure you've found your answer by now. Response is also for future readers). – eaglei22 May 08 '20 at 19:01
  • The application pool is NOT recycled when you update the files. but the AppDomain is reloaded. `Application_Start` does fire, but please remove the confusing statement about App pool recycle. See here: https://stackoverflow.com/a/64671746/56621 – Alex from Jitbit Feb 28 '21 at 12:40
0

If your Global.asax Application_Start code is not firing on a IIS published web:

Try changing your application AppPool to ASP.NET v4.0 Classic. Stop the AppPool Start the AppPool Recycle the AppPool.

Check if it works.