title: Settings from system.webserver sometimes removed from web.config file
body: <p>We've come across a rather annoying bug in IIS7.5 where it occasionally removes the contents of the  tag in the web.config. It doesn't just remove the contents at runtime, it actually physically updates the file.</p>
  
  <p>On our local machines it happens when we rebuild everything (which includes replacing application.config from source control) and on our server machines it happens on app pool restart. Both cases are intermittent. </p>
  
  <p>It seems to be happening because we have some config at the root of the config and some in a location tag. The reason we do this is because we have some virtual applications underneath the root application and we don't want them to inherit the handlers and modules. We have the root system.webserver tag because there are some settings (like validateIntegratedModeConfiguration) that we want to inherit. </p>
  
  <p>It only affects the system.webserver settings not inside the location tag. If you move everything into the location tag it is fine. </p>
  
  <p>Our web.config looks something like this:</p>
  
  <pre><code>&lt;system.webServer&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
      ...
  &lt;/system.webServer&gt;
  &lt;location path="." inheritInChildApplications="false"&gt;
      &lt;system.webServer&gt;
        &lt;modules&gt;
          ...
        &lt;/modules&gt;
        &lt;handlers accessPolicy="Read, Script"&gt;
          ...
        &lt;/handlers&gt;
      &lt;/system.webServer&gt;
   &lt;/location&gt;
  </code></pre>
  
  <p>Anyone else come across this problem? </p>