When Did App Pool or Web Application Start?

L

lucius

I need to know from within my ASP.NET 2.0 Web Service, when the
application was started as a DateTime. The service might run on
Windows Server 2000, maybe 2003, maybe 2003 R2, maybe XP (in
development on my desktop), so it might run inside an App Pool, or it
might just be a virtual directory.

How can I get this information?

Thanks.
 
S

Steven Cheng[MSFT]

Hello Lucius,

Yes, as you said, in IIS5 and IIS6, ASP.NET application(or other IIS hosted
server-side application) will have different process model. On IIS5, it
doesn't use application pool model, and use the "Protection Level" to
determine the worker process isolation model. While in IIS6, it use
application pool model, thus, any applications share the same application
pool will be hosted in the same worker process.


For your scenario, if what you want to get is the startup point of the
ASP.NET application, you can consider using the ASP.NET application(Global
object)'s Start event to capture the startup time(this event is fired only
once during an ASP.NET application's lifecycle).

#INFO: Application Instances, Application Events, and Application State in
ASP.NET
http://support.microsoft.com/kb/312607/en-us

e.g.

========================
namespace WebApplication1
{
public class Global : System.Web.HttpApplication
{

protected void Application_Start(object sender, EventArgs e)
{
//log the time here...
}
..................

========================

Also, if you need to retrieve this info out-side. You can consider writing
it into a log file or create a custom performance counter so that external
applications can also access this values.

Here is a MSDN reference and web articles which detailedly describe other
server-side events associated with ASP.NET runtime lifecycle:

#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx

http://www.eggheadcafe.com/tutorials/aspnet/7ea62799-d1cb-42ee-a1f2-e68b28db
e836/restart-aspnet-apps-prog.aspx

http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

Hope helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Thomas Hansen

I need to know from within my ASP.NET 2.0 Web Service, when the
application was started as a DateTime. The service might run on
Windows Server 2000, maybe 2003, maybe 2003 R2, maybe XP (in
development on my desktop), so it might run inside an App Pool, or it
might just be a virtual directory.

How can I get this information?

Create a Global.asax and set some publicly available property of type
DateTime in the "Application_Start" method...

..t
 
S

Steven Cheng[MSFT]

Hello Lucius,

Any further questions on this or does the information in previous replies
help you some? Please feel free to post here if there is anything else we
can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top