views:

367

answers:

2

Why does the application restart automatically when we create a new folder under a web site in IIS 7.0 or Cassini?

Is it a config we can change ? What is the impact ?

I read this post and the post not answer to my question

+1  A: 

I had the exact same issue so I decided NOT to write files/folder on the root of my web app. I noticed that on my dev computer but not on some servers (W2K3). Also try running the AspNetCompiler msbuild task to your site with updatable in false.

sebastian
+2  A: 

I found a solutions.

There is the link

Put this code in the application start of the global.asax

PropertyInfo p = typeof(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[] { });
Cédric Boivin