Thread: ASP.NET/Running a website from a network share or NAS device.

Running a website from a network share or NAS device.

The easy solution is - don't host your content on a SAN. Go cloud; put the content on S3, your server on EC2, and use CloudFront to make that tiny server scale like mad. If that's not an option, keep reading.

Part 1: 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

Part 2: Stop ASP.NET from spinning up an individual watcher for every single folder on the website.

There are two solutions (other than not using a SAN)

  1. Disable FCN (File change notifications) completely for ASP.NET. (Has side effects - no restart on web.config change, output cache gets dirty)
  2. Raise the command limit (has a ceiling that you will hit if you have over 40,000 folders in sites on your server). To reiterate, this is a server-wide limit, not a site-specific limit. Each watcher also consumes I/O and CPU resources, so simply raising the limit will have an impact.

Disabling FCN

  1. Open Regedit

  2. Add a DWORD at HKLM\Software\Microsoft\ASP.NET\FCNMode, with a value of '1'

  3. If you are running a 32-bit process on an x64-based system, add the DWORD value at the following registry key:

  4. HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\FCNMode

Microsoft also documents a value '2' that is supposed to use recursive monitoring and only create one FileSystemWatcher/DirectoryChangeNotification object.

Our testing of '2' was unfortunately hindered by a simultaneous problem with IIS, so we don't know if '2' will work, or if its failure was actually IIS's web.config watcher.

This registry setting was introduced through updates, not a major release, so make sure your system is fully patched to get the best results. And share your experience and results so we have more data to draw from.

Many companies are successfully running over 20TB of imagery through IIS and ASP.NET, so although it can be challenging, it's possible. I've helped several companies solve their IIS/ASP.NET scaling problems, so feel free to contact me at if you have any questions.