473,508 Members | 2,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restart Web Application in Global.Asax?


In the Application_OnStart, I make some data calls and place the
results in the HTTP cache. Sometimes, the database is not available
when the application starts up, so I want to sleep for 20 seconds and
then restart the entire application.

What is the best way to do that?

Thanks.

Nov 18 '05 #1
1 4077
Hi Localhost,
Thanks for posting in the community!
From your description, you're wanting to manually restart the ASP.NET
application in application's Application_Start Event when the app is first
time launched and after you finished some data initial operations(about
20-30 seconds), yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, every ASP.NET web application is limited in a
separate AppDomain itself. And currently, the framework doesn't seem to
provide buildin explicit APIs for restarting the asp.net programmatically
in application self. However, there're some situations which may cause the
aspnet_wp worker process or a certain application's appdomain restart
passively, here is the circumstances:

# Setting an attribute in the <processModel> element of the application's
Web.config file that causes a new process to start when a condition is met,
such as memoryLimit.

# The Global.asax or Web.config file is modified.

# Changes to the \Bin directory of the Web application.

# Antivirus software scans and modifies the Global.asax file, the
Web.config file, or a file in the \Bin directory of the Web application.
But the above circumstances can't ensure the appdomain or workprocess
restart immediately, maybe it'll need one or two minute for the app to deal
with some processing tasks for the current service requests.

In addition, I still recommend that you not restart the whole
application(appdomain) since that'll cause many unnecessary initialize
operations. Do you think it possbile that you just sleep for several
seconds and then contrinue the web app without restart the web application?
Or just sleep the thread and create another background thread to finish
some other operations?

Further more, the ASP.NET process model within IIS5 and IIS6 are also quite
different. The IIS6 provide some further features to control workerprocess,
you may have a view at the following reference if you're using IIS6:

#IIS 6.0 Application Isolation Modes
http://msdn.microsoft.com/library/en...0applicationis
olationmodes.asp?frame=true

Please check out the preceding items. If you have any questions, please
feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2

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

Similar topics

2
4560
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
6
2620
by: jim | last post by:
Hi All, I like to know the life cycle of an ASP .NET Application( incudieng server application, such as .NET Web Service). That means from initialization to fully running and how to reboot it or...
4
4966
by: Kenneth P | last post by:
Hi, I have my asp.net apps on a web hotel, and thus I have whatsoever no control of the IIS on my server. If I make a change in the global.asax for my application,. what is needed to get the...
8
4845
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
3
2770
by: ad | last post by:
I want to renew all values of Application and Session. How can I restart application in program?
3
3182
by: John A Grandy | last post by:
In ASP.NET 1.1 and/or 2.0 ..... Is it possible to configure a web-app so that replacement of an .xml file ( physically located under the virtual dir root ) with a newer version of the file...
3
2139
by: Ray Booysen | last post by:
In our application, we merge documents for our clients. The directory structure is as follows: webroot ->bin ->Documents ->Company -> Company X
4
1209
by: mark4asp | last post by:
How can I shut down (only one) ASP.NET website on the server. Problem. I have updated my web-site but the site which I see is the old one (the one there prior to the update). I do I force...
1
2626
by: Brian Simmons | last post by:
Hi All, I know that if you modify the web.config file or any file in the App_Code subfolder, that ASP.net 2.0 will "restart" the application (i.e. clear out any sessions, etc...). Are there...
0
7225
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
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
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,...
1
5052
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...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.