How does ASP.NET check for changes to aspx files ?

J

Joseph Farmer

I would like to understand how ASP.NET 1.1 detects changes to aspx files and
then forces an unload of the application domain (forcing a recompilation) -
can anyone give me a clue as to where I can start looking ?

Joseph Farmer
 
J

Joseph Farmer

Juan,

Ok, thanks - so once it detects that a file has changed how does it force
the application domain to be unloaded ?

Joseph
 
S

Scott Allen

Hi Joe:

The appdomain is not necessarily restarted, but there is a setting
called numRecompilesBeforeApprestart in the <compilation> section of
machine.config. Once the # of dynamic compiles exceeds this number
(the default is 15) the app domain will restart.

There are Load and Unload methods on the System.AppDomain class if you
want to experiment with AppDomains yourself.
 
J

Joseph Farmer

Scott,

The problem with trying to unload the AppDomain using AppDomain.Unload is
that any code in the website which tries to do this will fail because it is
trying to unload itself. This is why I was trying to grasp how ASP.NET does
it - in case there is some other solution which I can hook into which means
I don't write code which tries to unload itself. Hope this is clear.

Joseph
 
S

Scott Allen

Hi Joeseph:

The general approach is to work with 2 AppDomains - a "main" AppDomain
that loads and kicks off execution in a second "worker" domain that
can be unloaded when needed. This is essetially what ASP.NET is doing.

You can see some of this architecture outside of ASP.NET if you google
around for .NET plugin patterns. Many people write plugins to work in
a seperate AppDomain so that the plugin can be unloaded (individual
assemblies cannot be unloaded, so this is the only way to get a plugin
out of memory and unlock dlls).
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top