Folders to exclude from antivirus scanning in ASP.NET applications
This article helps you resolve the problem that the
AppDomain in ASP.NET applications might be unloaded when some folders aren't excluded by antivirus software.
Original product version: ASP.NET, .NET Framework 4.8, 4.7, 4.6, 4.5.2, 3.5 Service Pack 1
Original KB number: 3126034
In ASP.NET applications, certain folders should be excluded from antivirus scanning. If they are not, the scan could cause inadvertent
AppDomain unloads, and this causes performance issues.
ASP.NET uses the
ReadDirectoryChangesW Win32 function to monitor directories and files. In the following scenarios, the ASP.NET
AppDomain class is unloaded:
The application's physical root path and all of its subdirectories are monitored for subdirectory name changes or deletions. The
AppDomainis unloaded if any of these changes.
App_Browserssubdirectories of the application root folder are monitored for creation, deletion, renaming, ACL changes, changes to the last-write time, and changes to the size. If any of these things change, the
machine.configand root web.config files are monitored for changes. A change to either of these files will unload the
The web.config file of parent applications is monitored. A change to this file will unload the
The web.config file in the application root is monitored. A change to this file will unload the
hash.webfile that's located in the hash subdirectory of the Temporary ASP.NET Files folder is monitored. This monitoring was added to support development scenarios in which both the
ClientBuildManagerand the runtime
BuildManagerare updating the application files. Because there are two build managers, there was a need to keep them in sync, and the
hash.webfile is used for that purpose.
The web.config file in any subdirectory of the application is monitored. A change to this file will unload the
App_LocalResourcessubdirectory of each virtual subdirectory is monitored for creation, deletion, renaming, ACL changes, changes to the last-write time, and changes to the size. If any of these things change, the
Based on the files and folders that are monitored, the following directories are recommended for exclusion from antivirus scanning:
- The root directory and all of its subdirectories for the ASP.NET application.
- The .NET Framework config files directory. This varies by the version of .NET Framework and on whether the ASP.NET application is running in 32-bit or 64-bit processes.
- The root directory of the ASP.NET application's parent application.
- The Temporary ASP.NET Files folder.
We also recommend that the following IIS directories be excluded from antivirus scans in ASP.NET applications:
AppDomain unloads, disable
FCNMode (FCN stands for File Change Notification). For information about how to disable
FCNMode, see ASP.NET 2.0-connected applications on a website may appear to stop responding. However, disabling FCNMode is not recommended.