All,
I'm not sure this belongs in this forum. I'm a little confused on where I would post questions/changes to the CORE of dnn (i.e. not a module) so if someone wants to move this, GFI.
I am having a frequent restarts on my 1and1 host and trying to get their tech support to answer a question like:
"What are your recycle settings for my app pool?" is just too darn frustrating. Kinda funny though. When I called their tech support, instead of the guy saying we didn't know what I was talking out, he said he found a bug and needed to change the code!!! What code? He's going to get into wp3.exe and change Microsoft's Application Pooling code? I just hung up on him... I really wish it wasn't such a pain to transfer a .org domain!
Anywho.. I came up with this code and put in the global.vb LogEnd() method. Feel free to use.. I think they should include this in the next release also. However, I am not a VB programmer (I'm a C# guy) and I'm not sure if VB has a switch statement so I took the lazy approach (if-then-elseif blah, blah, blah). This even works with 1and1's very restrictive CAS policies.
Enjoy
Frank
''' -----------------------------------------------------------------------------
''' <summary>
''' LogEnd logs the Application Start Event
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [cnurse] 1/28/2005 Moved back to App_End from Logging Module
''' </history>
''' -----------------------------------------------------------------------------
Private Sub LogEnd()
Try
Dim objEv As New EventLogController
Dim objEventLogInfo As New LogInfo
objEventLogInfo.BypassBuffering = True
'FTC CHANGE 11/30/2006 - Added ShutDown Reason
Dim shutReason As System.Web.ApplicationShutdownReason = System.Web.Hosting.HostingEnvironment.ShutdownReason()
Dim shutMessage As String
If (shutReason = System.Web.ApplicationShutdownReason.BinDirChangeOrDirectoryRename) Then
shutMessage = "The AppDomain shut down because of a change to the Bin folder or files contained in it."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename) Then
shutMessage = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.ChangeInGlobalAsax) Then
shutMessage = "The AppDomain shut down because of a change to Global.asax."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.ChangeInSecurityPolicyFile) Then
shutMessage = "The AppDomain shut down because of a change in the code access security policy file."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.CodeDirChangeOrDirectoryRename) Then
shutMessage = "The AppDomain shut down because of a change to the App_Code folder or files contained in it."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.ConfigurationChange) Then
shutMessage = "The AppDomain shut down because of a change to the application level configuration."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.HostingEnvironment) Then
shutMessage = "The AppDomain shut down because of the hosting environment."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.HttpRuntimeClose) Then
shutMessage = "The AppDomain shut down because of a call to Close."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.IdleTimeout) Then
shutMessage = "The AppDomain shut down because of the maximum allowed idle time limit."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.InitializationError) Then
shutMessage = "The AppDomain shut down because of an AppDomain initialization error."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.MaxRecompilationsReached) Then
shutMessage = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.PhysicalApplicationPathChanged) Then
shutMessage = "The AppDomain shut down because of a change to the physical path for the application."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename) Then
shutMessage = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it."
ElseIf (shutReason = System.Web.ApplicationShutdownReason.UnloadAppDomainCalled) Then
shutMessage = "The AppDomain shut down because of a call to UnloadAppDomain."
Else
shutMessage = "No shutdown reason provided."
End If
objEventLogInfo.AddProperty("ShutDownReason", shutMessage)
objEventLogInfo.LogTypeKey = Services.Log.EventLog.EventLogController.EventLogType.APPLICATION_SHUTTING_DOWN.ToString
objEv.AddLog(objEventLogInfo)
Catch exc As Exception
LogException(exc)
End Try
' purge log buffer
LoggingProvider.Instance.PurgeLogBuffer()
End Sub