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

Appdomain unloaded when a file in App_Code is modified

I've seen many articles that claim the files in the App_Code directory are
treated in the same way as aspx-files in ASP 1.1. Well, this does not seem to
be the case, at least in Web Developer 2005 Express Beta2. If I change
anything in any of the class files residing in App_Code, the AppDomain is
unloaded and all application data, including all sessions, is lost. Is there
anything I can do to prevent this?

This undesired side-effect means that I still cannot make any changes in a
critical production site without informing the customer in advance and
running the service down at a predefined time. Aspx-files are still the only
files that can be modified at runtime without unloading the AppDomain.

Why can't the new assembly be loaded in the current AppDomain? And is this
going to change for the final release or is the feature by design?
Nov 19 '05 #1
5 2520
IIRC it's because these files need to be recompiled into the site DLL(s)
which means that the app is restarted.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"jake" wrote:
I've seen many articles that claim the files in the App_Code directory are
treated in the same way as aspx-files in ASP 1.1. Well, this does not seem to
be the case, at least in Web Developer 2005 Express Beta2. If I change
anything in any of the class files residing in App_Code, the AppDomain is
unloaded and all application data, including all sessions, is lost. Is there
anything I can do to prevent this?

This undesired side-effect means that I still cannot make any changes in a
critical production site without informing the customer in advance and
running the service down at a predefined time. Aspx-files are still the only
files that can be modified at runtime without unloading the AppDomain.

Why can't the new assembly be loaded in the current AppDomain? And is this
going to change for the final release or is the feature by design?

Nov 19 '05 #2
i really wouldn't use inproc sessions on a critical production server. as
several events can cause a recycle, in a critical site you should always be
able to recover lost sessions.

-- bruce (sqlwork.com)

"jake" <ja**@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
I've seen many articles that claim the files in the App_Code directory are
treated in the same way as aspx-files in ASP 1.1. Well, this does not seem
to
be the case, at least in Web Developer 2005 Express Beta2. If I change
anything in any of the class files residing in App_Code, the AppDomain is
unloaded and all application data, including all sessions, is lost. Is
there
anything I can do to prevent this?

This undesired side-effect means that I still cannot make any changes in a
critical production site without informing the customer in advance and
running the service down at a predefined time. Aspx-files are still the
only
files that can be modified at runtime without unloading the AppDomain.

Why can't the new assembly be loaded in the current AppDomain? And is this
going to change for the final release or is the feature by design?

Nov 19 '05 #3
Curt is right about causing DLL's to be recompiled. But you can still
avoid taking your site down. You have a couple of options:

1. Use non-inproc sessions. You can use another server or, better yet,
sql server to store session: http://idunno.org/dotNet/sessionState.aspx

2. Use a clustering solution. You can use Windows Load Balancer to map
two distinct computers to one ip address. Clients will get a session
that is "sticky" to one computer or the other. When you need to make
changes to an assembly you do it by updating one computer at a time.
Pull one computer out of the cluster by typing "wlbs stop" at the
command line. The computer will drain connections. This means that
current sessions will be preserved but new connections won't be
allowed. After 20 - 30 minutes the computer should be drained (wlbs
status). Make your changes, add the computer back to the cluster (wlbs
start) and repeat. Your site will run interrupted.

Matt Furnari

Nov 19 '05 #4
Thanks for the fast reply. Yeah, I know that's what happens. However, a new
dll is also created when an aspx-page is changed. When the aspx-page is
modified, it is compiled into a new assembly that includes the modified Page
class. But instead of throwing away the AppDomain, it just loads the new
assembly in the same AppDomain. I am not exactly sure of the details, but
somehow the new assembly is then used instead of the old one. I checked
what's going on in the Temporary ASP.NET Files -directory when I modified an
aspx-page and executed it. The old version (App_Web_xxxx.dll) was renamed to
App_Web_xxxx.dll.delete and a new App_Web_yyyy.dll was created (xxxx and yyyy
seem to be just some random sequences). When I modified a class file in the
App_Code directory, new versions of both App_Web.dll and App_Code.dll were
created. The difference was that the old versions weren't renamed to .delete.

I still don't understand why the code in the App_Code directory can't be
handled in the same way as the code in aspx-pages. Couldn't the dll renaming
and other stuff be done in the same way as with aspx-pages? I know the old
versions can't be unloaded (at least in ASP1.1) so they consume some memory,
but it's the same with the compiled aspx-pages and I think it's the lesser of
two evils.

"Curt_C [MVP]" wrote:
IIRC it's because these files need to be recompiled into the site DLL(s)
which means that the app is restarted.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"jake" wrote:
I've seen many articles that claim the files in the App_Code directory are
treated in the same way as aspx-files in ASP 1.1. Well, this does not seem to
be the case, at least in Web Developer 2005 Express Beta2. If I change
anything in any of the class files residing in App_Code, the AppDomain is
unloaded and all application data, including all sessions, is lost. Is there
anything I can do to prevent this?

This undesired side-effect means that I still cannot make any changes in a
critical production site without informing the customer in advance and
running the service down at a predefined time. Aspx-files are still the only
files that can be modified at runtime without unloading the AppDomain.

Why can't the new assembly be loaded in the current AppDomain? And is this
going to change for the final release or is the feature by design?

Nov 19 '05 #5
Inproc sessions are just one thing (we don't use inproc sessions in all
services). But we use a lot of in-memory caching and our systems include some
long running business processes that need to store intermediate results in
memory etc. Sure, some caching can be done using out-of-proc methods, but
sometimes inproc is the only feasible solution for performance reasons.

We run our services in separate IIS app pools (one site per app pool) and
the app pool is configured to never recycle or shutdown. I don't think we
have had a single unexpected recycle to date when using this method. The
servers are rebooted periodically, but usually it only needs to be done when
installing Microsoft updates.

jake

"Bruce Barker" wrote:
i really wouldn't use inproc sessions on a critical production server. as
several events can cause a recycle, in a critical site you should always be
able to recover lost sessions.

-- bruce (sqlwork.com)

"jake" <ja**@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
I've seen many articles that claim the files in the App_Code directory are
treated in the same way as aspx-files in ASP 1.1. Well, this does not seem
to
be the case, at least in Web Developer 2005 Express Beta2. If I change
anything in any of the class files residing in App_Code, the AppDomain is
unloaded and all application data, including all sessions, is lost. Is
there
anything I can do to prevent this?

This undesired side-effect means that I still cannot make any changes in a
critical production site without informing the customer in advance and
running the service down at a predefined time. Aspx-files are still the
only
files that can be modified at runtime without unloading the AppDomain.

Why can't the new assembly be loaded in the current AppDomain? And is this
going to change for the final release or is the feature by design?


Nov 19 '05 #6

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

Similar topics

0
by: Derek Young | last post by:
I have a unit test I've written that tests a lot of managed C++/unmanaged C++/C# interactions. I'm running it under NUnit which creates a separate AppDomain for the test, runs it, then unloads the...
4
by: stu_pb | last post by:
I am designing a plugin system for a window application using .NET(C# specifically). One of the requirements of the plugin system is to be able to dynamically load/unload plugins. My initial...
6
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider...
1
by: BuddyWork | last post by:
I think I've found a possible issue with .Net AppDomain.Unload when using attribute LoaderOptimization.MultiDomain. Here you will need ProcessExplorer from SysInternals to see what assemblies...
1
by: Raveendra M | last post by:
Hi! I am working with ASP.NET application. In my page I am creating one Application Domain and in that domain I am calling my DLL. Using the methods of the dll. And unloading the Application...
1
by: Charles Herring | last post by:
In my asp.net application I upload a video file and then need to get the duration and other properties. I get "Attempted to access an unloaded AppDomain" when I instanciate the Video object. I am...
22
by: JPSutor | last post by:
when I use the AppDomain.UnLoad method (which calls the Thread.Abort method), I get the following error message AppDomain can not be unloaded because the thread 1378 can not be unwound out of it...
0
by: Vince | last post by:
My current project (a desktop application that’s currently developed on .net v1.1) call for 1) Use ngen.exe to improve the startup speed. 2) Use multiple AppDomain to reduce the memory...
0
by: Zeya | last post by:
Situation: Using C#, ASP.Net Requirement: 1. ASP.net application with virtual hosting service. 2. Requires a service that will run every predefined frequency in minutes (2, 30, 100, 10000)...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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,...

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.