Home Dashboard Directory Help

[ASP.NET] No way to disable AppDomain restart when deleting subdirectory by Tomas_Petricek


 as External Help for as External

Sign in
to vote
Type: Suggestion
ID: 240686
Opened: 11/24/2006 3:56:33 PM
Access Restriction: Public


When ASP.NET application programatically deletes subdirectory in the application root folder, the ASP.NET runtime automatically restarts AppDomain (even if the subdirectory is located in the App_Data folder!).

Sign in to post a comment.
Posted by No way to disable AppDomain restart when on 4/23/2008 at 5:53 AM
For something considered so important to Microsoft (that they restart the AppDomain after every slight file/folder change), it amazes me that Microsoft are content to let us use a workaround that turns off this feature. I thought .NET enabled the developer to dictate when compilations occured? Why is the Framework taking an all of nothing approach?
I would like to know the downsides to using this work around. Are there any caching issues / memory issues / performance issues from not having this running and recycling? Please can someone in the know offer some peace of mind with using this workaround. Thanks.
Posted by Hone on 2/25/2008 at 10:59 PM
I see Tomas reopened this on 1/28/08 and then it was immediately closed again on the 29th. Can you please provide more explanation about this? Seems like it would be simple to create a flag that can be used in web.config to disable this functionality that is causing difficulty for a number of developers, myself included.

At least give us an explanation on why this is closed.
Posted by Tomas_Petricek on 1/28/2008 at 5:13 PM
I reopened the problem - I would like to see an explanation on what "Closed (External)" means. Thanks.
Posted by Alexander Viken on 10/2/2007 at 6:58 AM
Could we please have this issue re-opened?
Posted by Nathanael Jones on 7/28/2007 at 9:59 AM
Note to everybody: MS aggressively closes bug reports. They only pay attention to those which are defensively re-opened. Edit your report, and set the status back to Open, or they will never look at it again.
Posted by PAULL on 7/4/2007 at 1:59 AM
A response from Microsoft on why this is classified as "Closed (External)" is needed. This is still a bug in current releases as far as I can tell.

plq at timetrials dot co dot uk
Posted by Tomas_Petricek on 1/19/2007 at 3:39 PM
Hi! I noticed that status of this feedback was changed to "Resolved (External)". Can you please explain what does this mean? And what can we expect in the future versions?

Posted by Microsoft on 12/14/2006 at 10:20 AM
Hello Tomas,

We have routed this issue to the UIFX Server Team.

Keen Browne
Program Manager
Visual Studio
Sign in to post a workaround.
Posted by MaRaNtZ on 2/8/2008 at 7:58 AM
This should stop and shutdown that stupid FCN forever but i have not tested it very deeply, can someone confirm that this workaround do stop monitoring on every place and thus do not trigger the AppDomain restart ?

Dim p As PropertyInfo
Dim o As Object
Dim m As MethodInfo
p = GetType(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static)
o = p.GetValue(Nothing, Nothing)
m = o.GetType().GetMethod("Stop", BindingFlags.Instance Or BindingFlags.NonPublic)
m.Invoke(o, New Object() {})
Posted by Ambati Sreedhar on 9/23/2007 at 10:46 PM
Posted by [By]Kritter on 7/23/2007 at 6:51 AM
A dirty hack that works:
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[] { });

This code will turn off monitoring from the root website directory, but monitoring of Bin, App_Themes and other folders will still be operational, so updated DLLs will still auto deploy.
Posted by Tomas_Petricek on 11/29/2006 at 4:14 PM
RE: Toroid
Writing your own HttpHandler doesn't change anything and I can't imagine how mapping virtual directories could be used. The problem is that you need to access files from the application code. The simplest workaround is to save all data in direcotry not under the application root, but you often can't do this (shared hosting scenario for example)...
Posted by Toroid1 on 11/28/2006 at 5:04 AM
Write your own HttpHandler, Resources or use Virtual directories (Mapped in from a folder not whithin the App).
Posted by Tomas_Petricek on 11/24/2006 at 4:03 PM
Workaround described here: http://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx uses NTFS junction points to prevent OS from notifying ASP.NET about the change. This is however not usable solution in a many situations!