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("_theRuntime", 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, "myaddress@dotnet.itags.org.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?
SSal,
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:
Quote:
Originally Posted by
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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>
>
>
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_shutDownMessage={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 espaol : http://asp.net.do/foros/
======================================
"SAL" <SAL@dotnet.itags.org.nospam.nospamwrote in message news:ePstvOjJIHA.2268@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>
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:
Quote:
Originally Posted by
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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>
>
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...hange-notificat
ions-exactly-which-files-and-directories-are-monitored.aspx
Regards,
Walter Wang (wawang@dotnet.itags.org.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.
I'm looking into this Peter. Thanks
S
"Peter Bromberg [C# MVP]" <pbromberg@dotnet.itags.org.yahoo.NoSpamMaam.comwrote in message
news:8591BA80-8965-4E4E-88E2-246EC4D5E4A4@dotnet.itags.org.microsoft.com...
Quote:
Originally Posted by
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:
>
Quote:
Originally Posted by
>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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>>
>>
>>
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" <SAL@dotnet.itags.org.nospam.nospamwrote in message
news:ePstvOjJIHA.2268@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>
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]" <pbromberg@dotnet.itags.org.yahoo.NoSpamMaam.comwrote in message
news:8591BA80-8965-4E4E-88E2-246EC4D5E4A4@dotnet.itags.org.microsoft.com...
Quote:
Originally Posted by
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:
>
Quote:
Originally Posted by
>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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>>
>>
>>
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" <SAL@dotnet.itags.org.nospam.nospama crit dans le message de news:
ePstvOjJIHA.2268@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
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("_theRuntime", 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, "myaddress@dotnet.itags.org.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
>
0 comments:
Post a Comment