1
Error "Invalid file name for monitoring" in AppData\documentcache directory on compiled website
Problem reported by Marketing Department - 6/12/2019 at 7:35 AM
Submitted
Hi. I have a compiled .NET Framework MVC website in which DocumentUltimate is installed. Before any documents are cached, the site builds fine and DocumentUltimate works normally. Once documents are cached, however, I get the following error message when trying to build the site:

An error occurred loading a configuration file: Invalid file name for file monitoring: 
'C:\[website path]\App_Data\documentcache\~1l2z0eg\web.config'. 

Common reasons for failure include:  
- The filename is not a valid Win32 file name.  
- The filename is not an absolute path.  
- The filename contains wildcard characters.  
- The file specified is a directory.  
- Access denied.        

C:\[website path]\app_data\documentcache\~1l2z0eg\web.config        
I am using the latest version of DocumentUltimate via the DocumentUltimate.NuGetOrg and GleamTech.Core.NuGetOrg packages. How can I prevent this compilation issue?

1 Reply

Reply to Thread
0
Cem Alacayir Replied
Employee Post
It seems ASP.Net File Change Notification (FCN) does not like the tilde character (~) in the subfolder name generated under DocumentCache folder but the question is why does it monitor anything under App_Data folder on your machine in the first place? App_Data folder is a special ASP.NET folder which should be by default excluded from monitoring, it's meant to store application specific data and normally, writing under this folder should not trigger FCN or AppDomain recycles. So did you override any FCN specific settings on your machine?

The easiest solution would be to use a DocumentCache folder outside C:\[website path]
You can change the cache location via this property:

Other solutions:

A. Stop IIS from continually checking every folder for a web.config file

  1. Go to IIS manager.
  2. Click the server name in the left panel (not the site name)
  3. Scroll down and open Configuration Manager.
  4. Choose system.applicationHost/sites in the Section: field.
  5. Click (collection) to bring up the Collection Editor, select the web site you wish to modify
  6. In the bottom panel, expand the virtualDirectoryDefaults item.
  7. Change allowSubDirConfig to False instead of True
  8. Click Apply in the right-hand panel to save your changes.
B. Stop ASP.NET from spinning up an individual watcher for every single folder on the website.

Starting with the Microsoft .NET Framework 4.5 and later versions, FCNMode can be configured by using the httpRuntime settings.
This configuration will use a single watcher for the entire directory structure. While performance may still suffer, it should prevent outright failure:

  <httpRuntime fcnMode="Single"/>

References:

Reply to Thread