I have a website with a virtual directory that contains PDFs.
Users access the PDFs by using a URL such as http://myApp.com/PDFs/12345678.pdf, where PDFs
is a virtual directory mapped to \\\actualPhysicalServerName\PDFsDirectory\
.
This works.
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.
Accessing the above URL gives the following error:
An error occurred loading a configuration file: Failed to start monitoring changes to
\\\actualPhysicalServerName\PDFsDirectory\web.config
because access is denied.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()
Restarting the application pool does not help. I have to restart IIS. Once IIS is restarted, the virtual directory can be accessed as expected.
Is this expected behavior? Have I set up my virtual directories incorrectly?
I am using IIS 7.5, Windows 7 server, and .NET 4.5.
I solved this problem this way: