Cédric Boivin
Cédric Boivin

Reputation: 11361

Application pool restart automaticly if file change in repositery

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

Upvotes: 1

Views: 1093

Answers (2)

Cédric Boivin
Cédric Boivin

Reputation: 11361

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[] { }); 

Upvotes: 2

sebagomez
sebagomez

Reputation: 9619

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.

Upvotes: 1

Related Questions