You must Sign In to post a response.
  • Category: Career Guidance

    Application is automatically restart

    I have created an application and, I am facing one problem and came to know that My application is automatically restart while create new folder automatically in a system at run time.

    I have researched so many links and i found alternate solution, and using this solution i have put one key inside the web config - maxWaitChangeNotification="360000" waitChangeNotification="360000" and problem is solved

    But the main thing is that whenever i upload the new changes, i have removed that key because of no new changes were reflected on site(due to above key)

    I have used framework "2.0"

    Now i want to remove this key and get the permanent solution.

    So kindly suggest is there any way to "My web Application is not restart" while create new folder automatically in a system at run time
  • #768330
    It is the default behavior of W3WP services when you change any folder structure it gets recycled, to avoid it
    1. Adding "fcnMode="Disabled" to the <httpRuntime> settings in the web.config disables AppDomain recycling when the contents of the web root folder are altered.
    2. This code appears to resolve the issue, when added to Application_Start() in Global.asax:

    PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
    object o = p.GetValue(null, null);
    FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
    object monitor = f.GetValue(o);
    MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
    m.Invoke(monitor, new object[] { });

    With these changes, I can create/modify/delete folders without causing the application to restart
    Hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments