title: IIS forgets virtual directory permissions - An error occurred loading a configuration file: Failed to start monitoring changes
body: <p>I have a website with a virtual directory that contains PDFs.
  Users access the PDFs by using a URL such as <a href="http://myApp.com/PDFs/12345678.pdf" rel="noreferrer">http://myApp.com/PDFs/12345678.pdf</a>, where <code>PDFs</code> is a virtual directory mapped to <code>\\\actualPhysicalServerName\PDFsDirectory\</code>.
  This works.</p>
  
  <p>I routinely re-deploy the application. Once the application is redeployed and the website restarted, users can no longer access the virtual directory until IIS is restarted.</p>
  
  <p>Accessing the above URL gives the following error:</p>
  
  <blockquote>
    <p>An error occurred loading a configuration file: Failed to start monitoring changes to <code>\\\actualPhysicalServerName\PDFsDirectory\web.config</code> because access is denied.</p>
  
  <pre><code>at System.Web.FileChangesMonitor.FindDirectoryMonitor(String dir, Boolean addIfNotFound, Boolean throwOnError)
  at System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback)
  at System.Web.Configuration.WebConfigurationHost.StartMonitoringStreamForChanges(String streamName, StreamChangeCallback callback)
  at System.Configuration.BaseConfigurationRecord.MonitorStream(String configKey, String configSource, String streamname)
  at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
  </code></pre>
  </blockquote>
  
  <p>Restarting the application pool does not help.
  I have to restart IIS.
  Once IIS is restarted, the virtual directory can be accessed as expected.</p>
  
  <p>Is this expected behavior? Have I set up my virtual directories incorrectly?</p>
  
  <p>I am using IIS 7.5, Windows 7 server, and .NET 4.5.</p>