473,406 Members | 2,633 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,406 software developers and data experts.

Reason for Shutdown: HostingEnvironment

In my Application_End method in Global.asax, I log the shutdown reason
(System.Web.Hosting.HostingEnvironment.ShutdownRea son) and any errors
returned from Server.GetLastError(). Occasionally (2-3 times a day) I get a
shutdown for reason HostingEnvironment, with no errors.

Can anyone tell me what this is about?

(I'm running ASP.NET 2.0)

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006

Nov 10 '07 #1
4 9422
Hi Robert,
The Application_End event will fire whenever the application is shut down,
which you already know. There are reasons why the application will shut down
that have nothing to do with errors. The first is that simply nobody has
visited the site in roughly 20 minutes. Usually this period of time
corresponds to the session timeout value. So, 20 minutes after the last
person's session has been destroyed due to inactivity, the application is
shut down to perform garbage collection and regain resources (not to mention
just to keep an unused application off the system until it's needed again).

The second reason is the application pool has recycled. This means that the
system has hit a wall with regards to the amount of memory that the
application can use and needs to be shut down, perform garbage collection,
and restart with fresh resources.

In my experience, neither of these conditions will result in an error since
they are technically normal operation of the server.
--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Robert Dunlop" <rd*****@mvps.orgwrote in message
news:uW****************@TK2MSFTNGP06.phx.gbl...
In my Application_End method in Global.asax, I log the shutdown reason
(System.Web.Hosting.HostingEnvironment.ShutdownRea son) and any errors
returned from Server.GetLastError(). Occasionally (2-3 times a day) I get
a shutdown for reason HostingEnvironment, with no errors.

Can anyone tell me what this is about?

(I'm running ASP.NET 2.0)

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006

Nov 10 '07 #2
Thanks for your quick reply Mark.

Indeed, I had noticed that many of these shutdowns occurred after a period
of inactivity that seems to correspond with the session timeout I've set.
However, there are definitely times when this occurs during periods of
frequent activity, even with the relatively long timeout I've set.

A couple of questions regarding the second reason you presented:

1. This application is on a hosted solution (GoDaddy), so there are likely a
number of other applications on the server. When you say it is recycling
the application because it has hit a wall, do you mean that the resource
usage of my application has exceeded quota, or would this also happen
because of a system-wide condition?

2. I would like to take some metrics of my application's use of resources to
make sure I don't have a leak going on, but because I am on a shared host my
options seem to be limited. I have managed to access static methods of
ThreadPool to check on our thread usage, because I was concerned about our
use of a one-way web service to perform long running background tasks, but
I've never seen available threads drop below 395 out of 400, so I'm not
eating up the thread pool. What other metrics might I be able to attain in
a restricted environment, in particular I would like to get an idea of what
our memory footprint and CPU time are about. Unfortunately, all attempts
I've made to access the performance counters seem to be blocked, so that
route is out.....

Thanks for your help.

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:u8*************@TK2MSFTNGP04.phx.gbl...
Hi Robert,
The Application_End event will fire whenever the application is shut down,
which you already know. There are reasons why the application will shut
down that have nothing to do with errors. The first is that simply nobody
has visited the site in roughly 20 minutes. Usually this period of time
corresponds to the session timeout value. So, 20 minutes after the last
person's session has been destroyed due to inactivity, the application is
shut down to perform garbage collection and regain resources (not to
mention just to keep an unused application off the system until it's
needed again).

The second reason is the application pool has recycled. This means that
the system has hit a wall with regards to the amount of memory that the
application can use and needs to be shut down, perform garbage collection,
and restart with fresh resources.

In my experience, neither of these conditions will result in an error
since they are technically normal operation of the server.
Nov 11 '07 #3
Hi Robert,
It could be system-wide, it depends upon what other applications are in the
application pool. It could be that your application is sharing a pool with a
number of other sites. If that's the case, when overall memory usage exceeds
a certain amount, the pool will recycle. It could also recycle because of
some error that is corrupting things too much so the pool recycles to repair
it. I would say it would be more apt to be a memory issue. I have little to
no faith in GoDaddy's hosting though. They are the single largest source of
hosting issues for the FrontPage community and their support is rubbish and
has absolutely no clue. It wouldn't surprise me if they have everyone thrown
into the same pool together and the pool is just hitting a memory threshold
occasionally. The pool should also be set to recycle after X minutes,
usually about every 30 hours or so I think.

I'm not sure what other options are open as far as performance metrics if
you don't have access to the performance counters. You can probably get a
fair idea running the performance counters locally and beat on the app for a
while.

One of the biggest performance hits to make sure you're not doing is
publishing the site as a debug build versus a release build. Also setting
the debug="false" attribute of the compilation element of the web.config.
It's easy to forget it's set to debut and that will increase the footprint
of your app as it brings in other resources that wouldn't be needed with
release.
--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Robert Dunlop" <rd*****@mvps.orgwrote in message
news:O5**************@TK2MSFTNGP03.phx.gbl...
Thanks for your quick reply Mark.

Indeed, I had noticed that many of these shutdowns occurred after a period
of inactivity that seems to correspond with the session timeout I've set.
However, there are definitely times when this occurs during periods of
frequent activity, even with the relatively long timeout I've set.

A couple of questions regarding the second reason you presented:

1. This application is on a hosted solution (GoDaddy), so there are likely
a number of other applications on the server. When you say it is
recycling the application because it has hit a wall, do you mean that the
resource usage of my application has exceeded quota, or would this also
happen because of a system-wide condition?

2. I would like to take some metrics of my application's use of resources
to make sure I don't have a leak going on, but because I am on a shared
host my options seem to be limited. I have managed to access static
methods of ThreadPool to check on our thread usage, because I was
concerned about our use of a one-way web service to perform long running
background tasks, but I've never seen available threads drop below 395 out
of 400, so I'm not eating up the thread pool. What other metrics might I
be able to attain in a restricted environment, in particular I would like
to get an idea of what our memory footprint and CPU time are about.
Unfortunately, all attempts I've made to access the performance counters
seem to be blocked, so that route is out.....

Thanks for your help.

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:u8*************@TK2MSFTNGP04.phx.gbl...
>Hi Robert,
The Application_End event will fire whenever the application is shut
down, which you already know. There are reasons why the application will
shut down that have nothing to do with errors. The first is that simply
nobody has visited the site in roughly 20 minutes. Usually this period of
time corresponds to the session timeout value. So, 20 minutes after the
last person's session has been destroyed due to inactivity, the
application is shut down to perform garbage collection and regain
resources (not to mention just to keep an unused application off the
system until it's needed again).

The second reason is the application pool has recycled. This means that
the system has hit a wall with regards to the amount of memory that the
application can use and needs to be shut down, perform garbage
collection, and restart with fresh resources.

In my experience, neither of these conditions will result in an error
since they are technically normal operation of the server.

Nov 11 '07 #4
Hmmm, I had replied the other day, but it seems never to have shown up in
this thread - let me try this again:

Thanks for your quick reply Mark.

Indeed, I had noticed that many of these shutdowns occurred after a period
of inactivity that seems to correspond with the session timeout I've set.
However, there are definitely times when this occurs during periods of
frequent activity, even with the relatively long timeout I've set.

A couple of questions regarding the second reason you presented:

1. This application is on a hosted solution (GoDaddy), so there are likely a
number of other applications on the server. When you say it is recycling
the application because it has hit a wall, do you mean that the resource
usage of my application has exceeded quota, or would this also happen
because of a system-wide condition?

2. I would like to take some metrics of my application's use of resources to
make sure I don't have a leak going on, but because I am on a shared host my
options seem to be limited. I have managed to access static methods of
ThreadPool to check on our thread usage, because I was concerned about our
use of a one-way web service to perform long running background tasks, but
I've never seen available threads drop below 395 out of 400, so I'm not
eating up the thread pool. What other metrics might I be able to attain in
a restricted environment, in particular I would like to get an idea of what
our memory footprint and CPU time are about. Unfortunately, all attempts
I've made to access the performance counters seem to be blocked, so that
route is out.....

Thanks for your help.

--
Robert Dunlop
----------------
http://www.directxzone.org
http://rdunlop.spaces.live.com/
Microsoft DirectX MVP 1998-2006

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:u8*************@TK2MSFTNGP04.phx.gbl...
Hi Robert,
The Application_End event will fire whenever the application is shut down,
which you already know. There are reasons why the application will shut
down that have nothing to do with errors. The first is that simply nobody
has visited the site in roughly 20 minutes. Usually this period of time
corresponds to the session timeout value. So, 20 minutes after the last
person's session has been destroyed due to inactivity, the application is
shut down to perform garbage collection and regain resources (not to
mention just to keep an unused application off the system until it's
needed again).

The second reason is the application pool has recycled. This means that
the system has hit a wall with regards to the amount of memory that the
application can use and needs to be shut down, perform garbage collection,
and restart with fresh resources.

In my experience, neither of these conditions will result in an error
since they are technically normal operation of the server.
Nov 15 '07 #5

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

Similar topics

8
by: Jonathan Heath | last post by:
Hi all, I have created an ASP script that enters data into an Access Database. My problem is that I'd like this script to run when the computer is shutdown or the user logs off. I think...
0
by: Allan Bredahl | last post by:
Hi All I am trying to construct an application that is able to cancel a machine shutdown, reboot or logoff. And after performing some stuff to perform the original shutdown order :...
8
by: Bill Sonia | last post by:
I've written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that for OnShutDown, once my...
4
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
2
by: Brian Worth | last post by:
I have just upgraded from VB 4.0 to VB .NET 2002. One program under VB 4.0 was able to shut down or restart the (windows XP) machine using a series of API calls. (Getlasterror, GetCurrentProcess,...
1
by: Titeuf | last post by:
Hi, I work under VS2003 and I want to know how get the shutdown reason code ? On msdn nothing found...No api :( Have you an idea ? Thank's
4
by: Andrew | last post by:
I have ASP.NET 2.0 application. I'm running some initialization code in Application_Start() in Global.asax. If this code fails I would like to shutdown the application completely. Meaning no...
0
by: Pavel Kocar | last post by:
Hi all, how to detect existing .ascx control in Net 2.0? I try to use method in VirtualPathProvider: HostingEnvironment.VirtualPathProvider.FileExists("~/App_UserControls/ucDataPager.ascx");...
3
by: IdleBrain | last post by:
Gurus, I am trying to delay Windows Shutdown/Restart to perfrom cleanup and I am using the following code: protected override void WndProc(ref Message ex)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.