0

I am trying to optimize the no. of file reads made to "web.config" or "applicationHost.config" by my service. I'm planning to do it by reading the requested configuration into the memory if the same configuration is requested again for the same site or application. But I'm wondering how to notify my service when a change is made to the "web.config" or the "applicationHost.config". I read that when a change is made to "web.config" the AppDomain will be restarted but not for a change in "applicationHost.config". Is there a generic way by which the IIS notifies when a change is made to these files?

  • Service has a specific meaning in windows and it is not an IIS application. Can you clarify the question by making it clear if you mean an IIS application or a Windows Service? Hint, in PowerShell, Get-Service would return the details of a Windows service. – John Auld Jul 03 '14 at 15:28
  • it's a "Windows service". – Arul Prakash Jul 04 '14 at 02:22

1 Answers1

0

The File System has an API that allows monitoring of changes to files, which your service can use to listen for events. See the link below for some details and considerations.

https://stackoverflow.com/questions/4205643/how-to-handle-web-config-contents-update-event-how-to-detect-that-web-config-h

IIS has a configuration auditing feature, which may also be useful if the populates the event log when the files you are interested apply changes to the configuration. I am not able to test that now, but you can do so if monitoring the file system changes in not sufficient for your needs.

http://blogs.msdn.com/b/webtopics/archive/2010/03/19/iis-7-5-how-to-enable-iis-configuration-auditing.aspx

John Auld
  • 584
  • 2
  • 6