Is it possible to restart an app running under IIS without restarting IIS itself?

StageLeft

No Lifer
Sep 29, 2000
70,150
5
0
We have three web servers in a cluster. Out of the blue a couple of them are frequently going down with an asp.net application. The solution has been to copy the web.config from the remaining functional server over into the other two. The web.config is always the same over all servers, so what's in fact happening is that IIS thinks there is a new web.config file on the "dead" server, and is restarting the application. My question though is how can I manually restart the app without restarting IIS itself? Thanks!
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Can't say I've seen a 'restart application' option in IIS. The easisest way is to remove the application then create it and apply within the application properties menu in IIS.

As another note I found some things on the web that should cause an application restart:

- The max compilation limit is reached (look for numRecompilesBeforeApprestart in machine.config)

- Physical application path of the web application has changed.

- Change in global.asax or one of the included files

- Change in machine.config

- Change in web.config in the app root

- Change inside bin directory or its subdirs

- A directory is renamed to bin, or bin is created

- Overwhelming change notifications ? too many files are changed too fast in one of content directories ? could happen if, for example, files are generated on the fly per request

- Change in the code-access security policy file

- The settings of various attributes in in machine.config affect the restart/shutdown of the worker process itself. However, if you use Windows 2003, and (by default) you are NOT using IIS5 isolation mode, is ignored. Instead, the settings in "Application Pools" in IIS manager is used.
 

StageLeft

No Lifer
Sep 29, 2000
70,150
5
0
Thanks! So it seems that indirect methods are the only way to do it...I wonder if there is a command line util or something that will do it...
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Which version of IIS? If you are hosting on a w2k3 server you can place the app in a separate app pool and just recycle that app pool. You can even tell it to automatically recycle at certain times and so forth.

In old school ASP on win NT / 2k I ended up writing a simple function that would rename the global.asa to global1.asa and back to global.asa. You can do the same thing with web.config. You may also be able to interact with the thread, though that might use more privileges than you are willing to grant.