When Are Supporting dll Assemblies Loaded Into AppDomain?

S

Smithers

My ASP.NET Web app uses a few 3rd party assemblies. Just wondering when
those are loaded into the Web app's AppDomain - and for how long do they
stay loaded.

Is an assembly loaded the first time a page is loaded (where the page in
question makes use of the 3rd party assembly)? Or are all assemblies
referenced by the Web app automatically loaded whenever the Web site starts
(or is restarted)?

Thanks.
 
B

bruce barker

unless your code dynamically loads dlls (via the api), asp.net loads all
dll at startup (first request).

the .net runtime has no method to unload a dll. the appdomain must be
unloaded to release a dll.

-- bruce (sqlwork.com)
 
C

Chris Fulstow

Hi

All the assemblies are loaded from the /bin folder as soon as your
application receives its first request.
The ApplicationManager creates a new AppDomain, which then loads your
third-party assemblies. They'll stay loaded for the lifetime of your
AppDomain.

To see exactly which assemblies are loaded at any point you can run
something like:

Dim assemblies() As Assembly = AppDomain.CurrentDomain.GetAssemblies()
For Each asm As Assembly In assemblies
Response.Write(String.Format("Loaded: {0}<br>", asm.FullName))
Next

Chris
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top