大网数据广告活动
Web服务器与PHP

Exclude folders from antivirus scanning

· 52CE 我爱测

This article discusses a problem that In ASP.NET applications, certain folders must be excluded from antivirus scanning. If they are not, this might cause AppDomain to unload and then trigger performance issues.

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

Summary

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:

  1. The application's physical root path and all of its subdirectories are monitored for subdirectory name changes or deletions. The AppDomain is unloaded if any of these changes.

  2. The bin, App_Code, App_WebReferences, App_GlobalResources, and App_Browsers subdirectories 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 AppDomain is unloaded.

  3. The machine.config and root web.config files are monitored for changes. A change to either of these files will unload the AppDomain.

  4. The web.config file of parent applications is monitored. A change to this file will unload the AppDomain.

  5. The web.config file in the application root is monitored. A change to this file will unload the AppDomain.

  6. The hash.web file 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 ClientBuildManager and the runtime BuildManager are updating the application files. Because there are two build managers, there was a need to keep them in sync, and the hash.web file is used for that purpose.

  7. The web.config file in any subdirectory of the application is monitored. A change to this file will unload the AppDomain.

  8. The App_LocalResources subdirectory 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 AppDomain is unloaded.

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:

  • %systemroot%\System32\inetsrv\config
  • %systemdrive%\inetpub\temp

More information

To avoid 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.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 04/15/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。