views:

314

answers:

1

Hi,

I have noticed how editing the web.config file in an application folder causes that application pool to recycle and pick up the changes.

How does IIS achieve this and is it possible to extend this functionality for another config file? Or is this dependency hard-coded somewhere? This is related to the possiblity of deploying configuration changes to a web server without having to edit the web.config, which is usually maintained by a different team.

Note that I don't want to manually invoke this recycle event, but have it work in the same way as with web.config. I'm aware that I could simply add these settings to web.config, but that's not what I've been asked to do.

Many thanks, Robin

A: 

Actually the application pool is not recycle, just rebuild the site.

...to extend this functionality for another config file?
Well, when you change and save the other config file you can call this command to make rebuild the site

HttpRuntime.UnloadAppDomain();
Aristos
I wasn't aware that the web server rebuilds the site, I thought that editing the web.config (or changing assemblies) causes the app pool to recycle, in order to pick up the changes?
Robin Williams
@Robin iis is monitoring the files for changes. Maybe I have lost what you mean and ask.
Aristos
@Aristos Yes, I wonder how it monitors the files for changes? i.e. Can I extend this monitoring to watch my own config file?
Robin Williams
@Robin I check and I can not find a way, its seems that monitoring the files with internal process. I can not find a way that you can add your files or directory by hand.
Aristos
Yes, it certainly smells of hard-coded strings! Thanks for trying to help me; I can't tick your answer but have a +1. EDIT: Sorry, I don't have the rep to +1 people!
Robin Williams
@Aristos: Actually yes, have a tick - I'll make an extension using FileSystemWatcher or something and use your method.
Robin Williams