.cshtml code changes not shown until IIS manually restarted
Published in
1 min readJul 1, 2018
Problem
Our dev team faced a weird problem one day when we were working on a new subsite within an existing Sitecore instance. Each time we updated our .cshtml files, nothing was reflected on the site until we manually restarted IIS.
This was clearly not practical (and also tedious) as this site instance hosted another 8 subsites worked on by different developers and content authors/editors.
Symptoms
- Errors always pointing to the same line, even though you remove all the code from the affected .cshtml page.
- Simple changes (Adding / Updating new text) on page that can load, are not reflected.
- The above scenarios only change after a full IIS restart
Diagnosis
- Try replicating similar tasks on other instances within same server / IIS.
- If same behavior happens, means we found the cause! (look below)
Cause
File Change Notifications (FCN) is not working properly, hence file changes are not detected which should prompt AppDomain restart each time a change is detected.
Solution
- Site-specific change
Explicitly setting the HttpRuntimeSection.FcnMode property under ‘Web.config’ for site-specific setting.
Example: <httpRuntime fcnMode=”Disabled”/> - System wide change
Change the DWORD registry setting for HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\FCNMode to the value 0, which will enable all file change notifications.