Thursday, December 16, 2010

IISReset and There Go My Changes

Have you ever made changes in IIS 6 and then issued an IIS reset through the command-line or through the GUI and lost all the changes you just made? Oh come on, I can't be the only one. Anyway, apparently IIS 6 caches all of your changes and then writes them to disk automatically at some interval (about 5 minutes according to my testing). So, even if there are websites out there (and there are) that say that the metabase is flushed to disk when you issue a reset through the Internet Information Services Manager (IIS Manager), my testing has proven otherwise. Is it possible that this behavior is specific to my environment? Sure, but I have run the tests on multiple web servers (two different domains and one that was not part of a domain) with the same results.

So, what do you do to make sure this doesn't happen? It is actually very easy. Righ-click the web server in IIS Manager, select "All Tasks", and select "Save Configuration to Disk" before you click "Restart IIS . . .". Or, if you want to do it from the command line, run "cscript.exe %SYSTEMROOT%\system32\iiscnfg.vbs /save" before you run IISReset.

The other solution would be to restart all of the services without using IISReset. See this KB article for more details.