Does ASP.NET really do that?

A coworker told me that he noticed slow performance on our website when folders were deleted in the solution. We do not usually need to delete folders during production use, but he wanted me to look into it.

Sure enough, I was able to reproduce this behavior, furthermore I found others that had experienced the same problem, and a workaround.

void Application_Start(object sender, EventArgs e)
    // prevent file changes monitoring on subdirectories
    PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty(
        BindingFlags.NonPublic | 
        BindingFlags.Public | 

    FieldInfo f = p.GetValue(null, null).GetType().GetField(
        BindingFlags.Instance |
        BindingFlags.NonPublic |

    object monitor = f.GetValue(p.GetValue(null, null));
    MethodInfo m = monitor.GetType().GetMethod(
        BindingFlags.Instance | BindingFlags.NonPublic);

    m.Invoke(monitor, new object[] { }); 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s