Why does compiling MVC pages cause a persistent application to restart on my Azure web application?

My pre-compiled Azure web application is constantly restarting, and I cannot figure out how to fix it.

Here are the details:

  • This is an MVC 5 web project published as an Azure web application.
  • .Net Framework v4.5.2
  • The reason for the reboot is "BinDirChangeOrDirectoryRename" with this message: "Change notification for critical directories. Bin dir change or directory rename"
  • I added FileSystemWatcher to find out which files are changing, and always files like "bin \ App_Web_h2quortx.dll" and "bin \ dailyentry.cshtml.c45ee28a.compiled"
  • In the "Publish Settings" section, I chose the option "Precompile at Publish", which, as I thought, would not allow the pages to be compiled.
  • In the precompilation configuration, I tried various options, but so far nothing has worked.
  • This behavior does not occur immediately after publishing. It does not appear to be displayed until the application is visited after the application has timed out.
  • Restarting occurs almost every time you view the page, the first time the page is viewed after restarting the application.

Your help is greatly appreciated. Thank!

+4
source share
2 answers

dev.

,

  • , App_Start , -. WebConfig, App_Data ..

  • <httpRuntime fcnMode="Disabled" />
    

- > system.web

** - , - XML , .

+2

== > :

Log: . bin dir change HostingEnvironment . bin dir change or directory rename . bin dir change HostingEnvironment

"", Application_End :

var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
        var dirInfo = new DirectoryInfo(path);
        FileInfo[] files = dirInfo.GetFiles().OrderByDescending(p => p.LastWriteTime).Take(3).ToArray();
        foreach (var item in files)
        {
            Log.Info("FILE: " + item.FullName + " | " + item.LastWriteTime);
        }

** LastWriteTime , ** , - ! **** ****

StackTrace:

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.OnCriticaldirChange(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.QueueUserWorkItemCallback.WaitCallback_Context(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() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Edit: , app_end :

var dirInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
        FileInfo[] files = dirInfo.GetFiles("*.*", SearchOption.AllDirectories).OrderByDescending(p => p.LastWriteTime).Take(3).ToArray();
        foreach (var item in files)
        {
            Log.Info("FILE: " + item.FullName + " | " + item.LastWriteTime);
        }

3 *. , LastWriteTime , \strong > "bin " ?

0

Source: https://habr.com/ru/post/1666654/


All Articles