473,386 Members | 1,745 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,386 software developers and data experts.

Using health monitoring or code to recycle the application?

Hi

I've got an ASP.NET 2.0 application, and I would like to catch the scenario
of when I get a certain number of application errors, I want to restart the
application (similar to 'touching' web.config).

However, I don't have access to IIS, nor can I FTP in a new web.config file
to force the application to restart.I can't see any way at the moment to do
this through code, which would be good, as I can then restart it remotely
(through a web handler).

Is there any way in code that I can do this, either through health
monitoring for it to happen automatically, or through other code (perhaps
with me putting in my authentication details that I use to upload the site)
that can force an application restart?

Thanks in advance..

Glyn

--
Glyn Simpson
Money MVP
Feb 23 '06 #1
3 1716
Is there any way in code that I can do this, either through health
monitoring for it to happen automatically, or through other code (perhaps
with me putting in my authentication details that I use to upload the
site) that can force an application restart?


this is a trick: whenever you want your appdomain recycled, create a file
named App_Offline.htm inside the root of your application, wait 1 second,
asp.net will notice the file and recycle automatically, then cancel the file
or all of the requests will be redirected to this static file, and I'm sure
this is not what you want :-) by the way this trick is also used by vs.2005

spa.-
Feb 23 '06 #2
Glyn,

I've not used it myself, but you can use the new
WebConfigurationManager.OpenWebConfiguration Method, which give you write
access to web.config to touch the web.config and force a safe restart of the
application.

Whats interesting in your scenario is that you can do it from another web
application.

--
Regards

John Timney
Microsoft MVP

"Glyn Simpson, MVP" <gl**@serf.org> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
Hi

I've got an ASP.NET 2.0 application, and I would like to catch the
scenario of when I get a certain number of application errors, I want to
restart the application (similar to 'touching' web.config).

However, I don't have access to IIS, nor can I FTP in a new web.config
file to force the application to restart.I can't see any way at the moment
to do this through code, which would be good, as I can then restart it
remotely (through a web handler).

Is there any way in code that I can do this, either through health
monitoring for it to happen automatically, or through other code (perhaps
with me putting in my authentication details that I use to upload the
site) that can force an application restart?

Thanks in advance..

Glyn

--
Glyn Simpson
Money MVP

Feb 23 '06 #3
Thanks John and Spartaco

I am investigating using rewriting the web.config file, and programmatic
impersonation (http://west-wind.com/weblog/posts/1572.aspx) to do it and it
looks like, on initial tests I am able to remotely restart the application.
So i'm now halfway to the desired solution of a fully automatic restart.
I'll do a bit more reading up on the health monitoring to see if I can go
the whole hog, but if not, the halfway point helps enormously.

Thanks!

--
Glyn Simpson
Money MVP
I do not respond to any unsolicited email regarding Money
"John Timney ( MVP )" <ti*****@despammed.com> wrote in message
news:O5*************@tk2msftngp13.phx.gbl...
Glyn,

I've not used it myself, but you can use the new
WebConfigurationManager.OpenWebConfiguration Method, which give you write
access to web.config to touch the web.config and force a safe restart of
the application.

Whats interesting in your scenario is that you can do it from another web
application.

--
Regards

John Timney
Microsoft MVP

"Glyn Simpson, MVP" <gl**@serf.org> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
Hi

I've got an ASP.NET 2.0 application, and I would like to catch the
scenario of when I get a certain number of application errors, I want to
restart the application (similar to 'touching' web.config).

However, I don't have access to IIS, nor can I FTP in a new web.config
file to force the application to restart.I can't see any way at the
moment to do this through code, which would be good, as I can then
restart it remotely (through a web handler).

Is there any way in code that I can do this, either through health
monitoring for it to happen automatically, or through other code (perhaps
with me putting in my authentication details that I use to upload the
site) that can force an application restart?

Thanks in advance..

Glyn

--
Glyn Simpson
Money MVP


Feb 24 '06 #4

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

Similar topics

0
by: Fump | last post by:
Hello I create a test with application center to monitor my ASPNET web application ** Description test 8 hour 10 connection Enable Delays = Ye
1
by: athos | last post by:
Dear All, I am following the msdn guidelines (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000011.asp) trying the Health Monitoring module. Everything looks...
1
by: russell.lane | last post by:
This is a health monitoring for web applications / web services question. I'm trying to set up health monitoring for web services and a web application. To start very simply, I want to turn on...
2
by: wwwmike | last post by:
My applications (ASP.NET 2.0 /IIS 6) get restarted almost every 20 mintues. When asking my dear provider, he/she replied that I should have a closer look into my source code. Unfortunatelly they...
4
by: Maddy | last post by:
Hi all, I am new to DB2 database.I just have the basic knowledge abt this database.I in a serious situation of handling 5 large databases.Can some one help me how to prepare the health check...
1
by: =?Utf-8?B?RGlnaXRhbERpYW1vbmQ=?= | last post by:
I'm fairly new to dotNet but I've set up a web site and SQL database, with Health monitoring on which works fine localy on my development machine. However when ever upload the web site to our web...
1
by: brad.serbus | last post by:
I am trying to figure out a way to have health monitoring throw different Event IDs into the event log, and am having a hard time. None of the customization that I have looked through so far has...
0
by: andrew.douglas11 | last post by:
Hello all, I've been struggling on something that should be very easy. I want to log every unhandled exception that occurs in my web app to a text file. With the introduction of health...
2
by: paeh | last post by:
Can any expert help me. I need to finish up my final project system next year. Can anyone give me some idea how to code my system. My system details is below : 1.Develop modules for a...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.