Home > Back-end >  Site restart after removing folders from physical path. on IIS 10
Site restart after removing folders from physical path. on IIS 10

Time:09-21

We have functionality on asp.net 4.7 site which remove folder with static data (css, js) and generate same folder with updated (js,css) files. After folder removing with static data, site restarts. I get this error log :

ApplicationEnd: ShutDownMessage: Directory rename change notification for 'D:\Projects\MySite\src\WebProject'.
WebProject dir change or directory rename
HostingEnvironment initiated shutdown
Directory rename change notification for 'D:\Projects\MySite\src\WebProject'.
WebProject dir change or directory rename
Directory rename change notification for 'D:\Projects\MySite\src\WebProject'.
WebProject dir change or directory rename
HostingEnvironment caused shutdown 
 ShutDownStack:    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
   at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
   at System.Web.HttpRuntime.OnCriticalDirectoryChange(Object sender, FileChangeEvent e)
   at System.Web.FileChangesMonitor.OnSubdirChange(Object sender, FileChangeEvent e)
   at System.Web.DirectoryMonitor.FireNotifications()
   at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
   at System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

There are some settings in IIS (APPPool/site) that would not create a restart at the site after deleting this folder.

PS. I already investigate solution with fcnMode="Single" on web.config. This is not a solution for us.

<httpRuntime executionTimeout="180" targetFramework="4.7.2" requestValidationMode="2.0" maxRequestLength="104857600" fcnMode="Single"/>

CodePudding user response:

This is a normal behavior of IIS.

IIS will restart application or recycle application pool in following cases: the web.config is edited

  • the machine.config is edited
  • the global.asax is edited
  • files are changed in the bin directory of the web app, or one of the bin’s subdirectories
  • a directory is created, renamed, or deleted within a web app directory
  • an ASP.NET file (aspx, asmx, etc.) is edited (and therefore recompiled) more than 20 times, a default set in the machine config as an element named numRecompilesBeforeApprestart
  • by way of settings of various attributes in the element in the machine.config, which affect the restart/shutdown of the worker process itself.

You cannot stop this behavior because it is by designed. Unless you stop removing folder.

  • Related