5

What happens if a dll is already loaded by w3wp.exe and we replace it?

Of course we can replace a dll since asp.net uses a cached version of Bin folder DLLs, but I want to know if upon replacing a dll it will load the new one or it wait until next recycling or when there's no new request.

EDIT: DLL contains a singleton class

Alex Aza
  • 76,499
  • 26
  • 155
  • 134
Xaqron
  • 29,931
  • 42
  • 140
  • 205

2 Answers2

4

Your application will be compiled again once a dll is modified or added.

Your application's domain will be recycled when any change occurs in the bin directory or if its contents are modified.

Off The Gold
  • 1,228
  • 15
  • 28
Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
3

From MSDN:

If you change the .dll and write a new version of it to the Bin folder, ASP.NET detects the update and uses the new version of the .dll for new page requests from then on.

Alex Aza
  • 76,499
  • 26
  • 155
  • 134
  • My case is a bit complex. That's a `HttpHandler` and the DLL I replace contains a `Singleton` class. Since App domain is already loaded I guess new DLL won't be used until next `recycling`. – Xaqron May 31 '11 at 04:16
  • 1
    @Xaqron - it does not matter if dll contains `Singleton` class or not. It will recycle AppDomain and reload it. – Alex Aza May 31 '11 at 04:24