473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Webapp restarting randomly

SAL
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage",
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack", flgs,
Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second parameter,
which the docs say calls End which in turn raises a ThreadAbortException.
This, likely, would cause the app to restart. However, I'm not seeing where
I'm doing that so my next thought was that a menu click could be doing this.
Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the menu.
It seems that most of the time the e-mail I get is the following in which it
doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S
Nov 13 '07 #1
8 2852
Sal,
I think your first line of attack should be to put in unhandled exception
tracking rather than looking at the shutdown which comes later.
You can find plenty of example code via a search to "ASP.NET Unhandled
Exception"
Then you can nail down where and when the cause is.
--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"SAL" wrote:
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage",
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack", flgs,
Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second parameter,
which the docs say calls End which in turn raises a ThreadAbortException.
This, likely, would cause the app to restart. However, I'm not seeing where
I'm doing that so my next thought was that a menu click could be doing this.
Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the menu.
It seems that most of the time the e-mail I get is the following in which it
doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S
Nov 13 '07 #2
It looks like your translation to VB.NET missed something.

Can you test with Scott's original C# code ?

public void Application_End() {

HttpRuntime runtime = (HttpRuntime) typeof(System.Web.HttpRuntime).InvokeMember
("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);

if (runtime == null)
return;

string shutDownMessage = (string) runtime.GetType().InvokeMember
("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);

string shutDownStack = (string) runtime.GetType().InvokeMember
("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);

if (!EventLog.SourceExists(".NET Runtime"))
{
EventLog.CreateEventSource(".NET Runtime", "Application");
}
EventLog log = new EventLog();
log.Source = ".NET Runtime";

log.WriteEntry(String.Format("\r\n\r\n_shutDownMes sage={0}\r\n\r\n_shutDownStack={1}", shutDownMessage, shutDownStack),
EventLogEntryType.Error);

}

--------------------------------

That code should get you shutdown messages which include the reason for the shutdown, like :

_shutDownMessage=Change Notification for critical directories.
bin dir change or directory rename
HostingEnvironment caused shutdown
Directory rename change notification for 'E:\Unload'.
Unload dir change or directory rename

and...please make sure that the broken lines which begin with :

HttpRuntime runtime
and
string shutDownMessage
and
string shutDownStack

....are all on a single, unbroken, line.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================

"SAL" <SA*@nospam.nospamwrote in message news:eP**************@TK2MSFTNGP02.phx.gbl...
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b = Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime = GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing, Nothing,
Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage", flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack", flgs, Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr & shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this might be a result of doing a
Response.Redirect without the second parameter, which the docs say calls End which in turn raises a
ThreadAbortException. This, likely, would cause the app to restart. However, I'm not seeing where I'm doing that so my
next thought was that a menu click could be doing this. Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to control how it redirects to the page associated
with that node of the menu.
It seems that most of the time the e-mail I get is the following in which it doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object state)

Any thoughts on this???

S


Nov 13 '07 #3
look in the eventlog, the reason is listed. there are three common causes:

1) idle timeout, usually 20-30 minutes depending on your settings.

2) too much memory used. either too much data in session, or memory leak.

3) file changed in watched site. app writes file to web site, or a bad
behaving virus scanner (updates file stats).
note: thread aborts are not a cause.

-- bruce (sqlwork.com)

SAL wrote:
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage",
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack", flgs,
Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second parameter,
which the docs say calls End which in turn raises a ThreadAbortException.
This, likely, would cause the app to restart. However, I'm not seeing where
I'm doing that so my next thought was that a menu click could be doing this.
Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the menu.
It seems that most of the time the e-mail I get is the following in which it
doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S

Nov 14 '07 #4
Hi SAL,

I've just posted following information to your previous post about "session
lost" and I think it might be useful for this post too:

#Thomas Marquardt's Blog : ASP.NET File Change Notifications, exactly which
files and directories are monitored?
http://blogs.msdn.com/tmarq/archive/...ange-notificat
ions-exactly-which-files-and-directories-are-monitored.aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 14 '07 #5
SAL
I'm looking into this Peter. Thanks

S

"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:85**********************************@microsof t.com...
Sal,
I think your first line of attack should be to put in unhandled exception
tracking rather than looking at the shutdown which comes later.
You can find plenty of example code via a search to "ASP.NET Unhandled
Exception"
Then you can nail down where and when the cause is.
--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"SAL" wrote:
>Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSetting s("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_th eRuntime", flgs,
Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage =
runtime.GetType().InvokeMember("_shutDownMessage" ,
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack",
flgs,
Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second
parameter,
which the docs say calls End which in turn raises a ThreadAbortException.
This, likely, would cause the app to restart. However, I'm not seeing
where
I'm doing that so my next thought was that a menu click could be doing
this.
Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the
menu.
It seems that most of the time the e-mail I get is the following in which
it
doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShu tdownWorkItemCallback(Object
state)
at
System.Threading._ThreadPoolWaitCallback.WaitCall back_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S

Nov 14 '07 #6
SAL
Okay, I implemented using the code from Walter's post and now I'm getting
this. Sorry, it looks like I've got two threads going on this basic issue. I
thought the old thread was dead and then Walter responded to it... dang.

The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may be
able to use the /AUXSOURCE= flag to retrieve this description; see Help and
Support for details. The following information is part of the event:

_shutDownMessage=HostingEnvironment caused shutdown

_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean
needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading.

I don't really know what the description, above, means so a more
knowledgeable person would be nice. :)
S

"SAL" <SA*@nospam.nospamwrote in message
news:eP**************@TK2MSFTNGP02.phx.gbl...
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage",
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack",
flgs, Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second
parameter, which the docs say calls End which in turn raises a
ThreadAbortException. This, likely, would cause the app to restart.
However, I'm not seeing where I'm doing that so my next thought was that a
menu click could be doing this. Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the
menu.
It seems that most of the time the e-mail I get is the following in which
it doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S

Nov 14 '07 #7
SAL
Peter,
thanks for your link. Using the exception base, I logged the errors
(Application_Error event) to a log using the code that VB generated and it
was a virtual memory limit being exceeded that caused the shutdown it
appears. With limited testing on the server, that app seems much faster and
is not shutting down all the time.
I used the short cut logic for this production app to get a handle on that
one app. I'll likely be implementing your approach described on your web
link...
If it begins happening again, I'll be back (as Arnie would say)... :)

Thanks
S

"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:85**********************************@microsof t.com...
Sal,
I think your first line of attack should be to put in unhandled exception
tracking rather than looking at the shutdown which comes later.
You can find plenty of example code via a search to "ASP.NET Unhandled
Exception"
Then you can nail down where and when the cause is.
--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"SAL" wrote:
>Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSetting s("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_th eRuntime", flgs,
Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage =
runtime.GetType().InvokeMember("_shutDownMessage" ,
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack",
flgs,
Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second
parameter,
which the docs say calls End which in turn raises a ThreadAbortException.
This, likely, would cause the app to restart. However, I'm not seeing
where
I'm doing that so my next thought was that a menu click could be doing
this.
Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the
menu.
It seems that most of the time the e-mail I get is the following in which
it
doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShu tdownWorkItemCallback(Object
state)
at
System.Threading._ThreadPoolWaitCallback.WaitCall back_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S

Nov 15 '07 #8
As a side note you may want also to check the health montioring section in
the ASP.NET 2.0 section. It allows to monitor these events with details such
as the reason...

--
Patrice

"SAL" <SA*@nospam.nospama écrit dans le message de news:
eP**************@TK2MSFTNGP02.phx.gbl...
Hello,
I have a web app (asp.net 2.0) that I'm loosing Session variables in.
I implemented:
Application_End in Global.asax using the following code:
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("notifyOnAppShutDown"))
Catch ex As Exception

End Try
If Not b Then Exit Sub

Dim flgs As Reflection.BindingFlags
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static Or Reflection.BindingFlags.GetField
Dim runtime As HttpRuntime =
GetType(System.Web.HttpRuntime).InvokeMember("_the Runtime", flgs, Nothing,
Nothing, Nothing)

If runtime Is Nothing Then Return

Dim shutDownMessage As String
flgs = Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetField
shutDownMessage = runtime.GetType().InvokeMember("_shutDownMessage",
flgs, Nothing, runtime, Nothing)

Dim shutDownStack As String
shutDownStack = runtime.GetType().InvokeMember("_shutDownStack",
flgs, Nothing, runtime, Nothing)

' send email to me
SendMail.Send(vbCr & vbCr & shutDownMessage & vbCr & vbCr &
shutDownStack, "AnnexTrak Shutdown", _
Nothing, "my*******@ourcompany.com")
End Sub

And the app is indeed restarting pretty darned often. I was thinking this
might be a result of doing a Response.Redirect without the second
parameter, which the docs say calls End which in turn raises a
ThreadAbortException. This, likely, would cause the app to restart.
However, I'm not seeing where I'm doing that so my next thought was that a
menu click could be doing this. Is there a way to control that?
My menu is databound using the web.sitemap file so I'm not sure how to
control how it redirects to the page associated with that node of the
menu.
It seems that most of the time the e-mail I get is the following in which
it doesn't list a cause of the shutdown:

HostingEnvironment caused shutdown

at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object
state)

Any thoughts on this???

S

Nov 15 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Phil S | last post by:
My server is randomly restarting every few minutes or so, and I can't figure out why. What would cause this to happen, aside from some evil person sitting at the console? I did manage to catch it...
5
by: Flip | last post by:
I have a web app running on w2k3server, and I have an application level variable for a counter. Every once in a while today (I just put this live last night), that counter value is reset to 1 when...
1
by: Phil S | last post by:
My server is randomly restarting every few minutes or so, and I can't figure out why. What would cause this to happen, aside from some evil person sitting at the console? I did manage to catch it...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.