tags:

views:

29

answers:

3

I have a web application that dynamically loads assemblies based on database configuration entries to perform certain actions (dynamic plugin style architecture).

The calls to the objects are in a Factory Pattern implementation, and the object is cached (in a static dictionary<> within the Factory) as the calls can be made many thousands of times in a minute.

The calls to this factory are made from both the main web application and a number of webservices, some in different assemblies/projects.

When I need to update one of these DLLs, I have to recycle IIS to get the DLL released.

As this has an impact on another application on the server, I wanted to know if there was a way I could release the DLL without restarting IIS?

+2  A: 

There's absolutely no way to unload a loaded assembly other than killing the AppDomain which is basically what you are doing when you restart IIS.

Darin Dimitrov
+1  A: 

You can try restarting the application pool not the whole IIS server. Maybe that will do the trick for you

AZ
Nice idea - I'll look into this.
ck
+1  A: 

If you have an assembly that you need to load and unload you will have to jump through a few hoops.

  • the types being loaded must derive from MarshalByRefObject
  • the types being loaded must derive from an interface that will be used to call them
  • you must build a remoting based 'loader' to isolate the loaded assembly in a new appdomain, which can be unloaded.

see http://www.west-wind.com/presentations/dynamicCode/DynamicCode.htm for a good introduction. It is a bit dated and deals with dynamically generated code but given your rep I would assume that you can extract the relevant information.

Sky Sanders
Sounds like a lot of work, but thanks for the info.
ck
@ck it *is* a lot of work. But you do what you gotta do.
Sky Sanders