0

Hi and sorry for my poor English,

I have an Asp.Net application which was working fine until I add Log.Net framework (logging in a single file) and add picture generation in thread.

Randomly I lose all session variable.

I tried to not log with Log4Net ( in config file).

I added log in session_end in global.asax to know why app pool recycling is lunched and I get this stacktrace :

shutDownMessage=CONFIG change
HostingEnvironment initiated shutdown
HostingEnvironment a provoqué un arrêt.

_shutDownStack=   à System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   à System.Environment.get_StackTrace()
   à System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   à System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
   à System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
   à System.Web.Configuration.HttpConfigurationSystem.OnConfigurationChanged(Object sender, InternalConfigEventArgs e)
   à System.Configuration.Internal.InternalConfigRoot.OnConfigChanged(InternalConfigEventArgs e)
   à System.Configuration.BaseConfigurationRecord.OnStreamChanged(String streamname)
   à System.Web.Configuration.WebConfigurationHostFileChange.OnFileChanged(Object sender, FileChangeEvent e)
   à System.Web.DirectoryMonitor.FireNotifications()
   à System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
   à System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)
   à System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   à System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   à System.Threading.ThreadPoolWorkQueue.Dispatch()
   à System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

ShutDownMessage is "CONFIG change" but I made no change in config file, even in bin folder.

The only thing I made is deleting and creating picture in a specific folder of the website.

Can Asp.Net File Change Notification cause App Recycling to be launched even if I made no change in bin folder ?

Thanks in advance for help.

Christophe
  • 21
  • 3

2 Answers2

0

If it can help someone :

Adding FCNMode register key helped me

https://weblogs.asp.net/owscott/ASP.NET-v2.0-2D00-AppDomain-recycles_2C00_-more-common-than-before

"Furthermore, if many dozen files were added in short succession to each other, that would also case the same restart" --> Picture generation in thread in a folder in a Website cause AppDomain recycles for me (using windows server 2012 R2).

Christophe
  • 21
  • 3
0

This code in global.asax also work :

  Dim theRuntime = GetType(HttpRuntime).GetField("_theRuntime", BindingFlags.NonPublic Or BindingFlags.[Static]).GetValue(Nothing)
    Dim fcmField = GetType(HttpRuntime).GetField("_fcm", BindingFlags.NonPublic Or BindingFlags.Instance)
    Dim fcm = fcmField.GetValue(theRuntime)

    fcmField.FieldType.GetMethod("Stop", BindingFlags.Instance Or BindingFlags.NonPublic).Invoke(fcm, Nothing)
Christophe
  • 21
  • 3