Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C#: ASP.NET - Stop HttpRuntime file changes monitoring
// http://stackoverflow.com/questions/613824/how-to-prevent-an-asp-net-application-restarting-when-the-web-config-is-modified
internal static class HttpInternals
{
private static readonly PropertyInfo s_FileChangesMonitor = typeof(HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Static);
private static readonly MethodInfo s_FileChangesMonitorStop = s_FileChangesMonitor.PropertyType.GetMethod("Stop", BindingFlags.NonPublic | BindingFlags.Instance);
private static object FileChangesMonitor
{
get
{
return s_FileChangesMonitor.GetValue(null, null);
}
}
public static void StopFileMonitoring()
{
//HttpRuntime.FileChangesMonitor.Stop();
s_FileChangesMonitorStop.Invoke(FileChangesMonitor, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.