Sub Application_End() Dim lcShutDownMessage As String = "" Dim lcShutDownStack As String = "" Dim lnDateNow As Double = Date.Now.Ticks Dim lnDuration As Double = 0 Dim loHttpRuntime As HttpRuntime = Nothing Dim loUpdate As Update = Nothing oApp = App.oApp loUpdate = New Update(oApp) ' If we have an IISApplicationCycle table If Not oApp.Tables("IISApplicationCycle") Is Nothing Then lnDuration = ((lnDateNow - oApp.nDateNow) / 10000000) loHttpRuntime = DirectCast(GetType(System.Web.HttpRuntime).InvokeMember("_theRuntime", _ BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.GetField, Nothing, Nothing, Nothing), HttpRuntime) ' If it is running If Not loHttpRuntime Is Nothing Then lcShutDownMessage = DirectCast(loHttpRuntime.[GetType]().InvokeMember("_shutDownMessage", _ BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.GetField, Nothing, loHttpRuntime, Nothing), String) lcShutDownStack = DirectCast(loHttpRuntime.[GetType]().InvokeMember("_shutDownStack", _ BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.GetField, Nothing, loHttpRuntime, Nothing), String) End If ' Update the record loUpdate.cTable = "IISApplicationCycle" loUpdate.nPrimaryKey = oApp.nID loUpdate.ParameterAdd("Duration", lnDuration) loUpdate.ParameterAdd("ShutDownMessage", lcShutDownMessage) loUpdate.ParameterAdd("ShutDownStack", lcShutDownStack) If Not loUpdate.Update() Then Exit Sub End If End If End SubThis ERROR text is random. Sometimes, it is something else. It varies. The timeframe also varies. I can have it ok for days and in one single day, it would be like 200 restarts. This is a known issue and I am trying to find a workaround.
Sub Application_Start() Dim loFieldInfo As FieldInfo = Nothing Dim loMethodInfo As MethodInfo = Nothing Dim loObject As Object = Nothing Dim loObject2 As Object = Nothing Dim loPropertyInfo As PropertyInfo = Nothing ' This registration is only needed for the Web Service ' However, even if this is run under the Web site, it does not do anything RegisterSoapExtension(GetType(TraceExtension), 1, 0) ' Microsoft IIS/ASP.NET has a bug that after a very long period of time, it can start restarting the worker process ' several times per minute, for days, causing an enormous amount of load ' As there is no guarantee this will come back, we disable this FCN at this level ' 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 ' This technique can also be stored in Web.config under: ' <configuration> ' <system.web> ' <httpRuntime fcnMode="Disabled" /> ' </system.web> ' </configuration> ' But, that only works for .NET Framework 4.5 and up ' This is a great link: ' http://blogs.msdn.com/b/tess/archive/2006/08/02/686373.aspx loPropertyInfo = GetType(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static) loObject = loPropertyInfo.GetValue(Nothing, Nothing) ' Turn off FCN on the sub directories loFieldInfo = loObject.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase) loObject2 = loFieldInfo.GetValue(loObject) ' Send the deactivation notice loMethodInfo = loObject2.GetType().GetMethod("StopMonitoring", BindingFlags.Instance Or BindingFlags.NonPublic) loMethodInfo.Invoke(loObject2, New Object() {}) End Sub>Good explanation of IIS File monitoring here :