Proyect Description
How to make your application capable of Hot Deployment. This is a barely complete example using Visual Studio 2005 and .NET Framework 2.0 (can be portable to 1.0 and 1.1 too) of an hot deploy capable application.

Issue that start this proyect
We got an application that needs to update their assemblies without taking it down. So, after doing a huge investigation about the posibilities we start to make this project as a test.
Then, we moved our application to a COM+ components+, so our ASP pages can make use if it's functionality and it still works great. Now, we don't need to take the COM+ component down if we need to put a new assembly that is being used.

Current Status
This project is some sort of example with source code of how to make your application capable of hot deploy in some way.
I have been using this on some of my development and it works great.

Summary of the hot deploy process:
Once the application is running, the main entry point creates an Application Domain with shadowcopy enabled.
From this point, every action will be mapped to an Assembly that will be loaded into that Application Domain. So the original Assembly will not lock down. Further more, we create a FileSystemWatcher to monitor the file system for changes on the subdirectories where the assemblies are. If there is a changed, that FileSystemWatcher will tell us what has changed.
Because there are occasion where more than 1 assembly needs to be deployed, we make the hot deploy process to wait for X seconds till we actually do the deploy in order to wait for a full set of new assemblies to be copied in.
After that security time elapsed, we create a new application domain and start sending new requests to it. Meanwhile, the requests previously sent to the old Application Domain are waited for completition. As soon as the old domain serves all its queued request, we take it down.


Instructions
First of all, this is not a plug and play solution, you need to design your application to be capable of hot deployment, because it's not easy to understand and can be a little tricky to maintain.
We encourage you to download the source code and test yourself.

Setting up a test environment
You can download the source code from the Source Code tab from this page so you can test it to see if this fits your needs.

Reporting Errors
If you are running into errors using the example source code i have provided, feel free to report it in the correspoding tab.
When asking for help, please remember to include any information needed so I can reproduce your bug and correct it as soon as posible.

License
Please visit the license tab notes page for further information.

Note
This project is built and maintained using .NET Framework 2.0 capabilities, so I'm not sure if it will compile and run smooth on any other version of .NET Framework, though i have maintained the code really simple to understand. Feel feel to try and send me some feedback!

If you find this useful
If you find this example of any use, please also consider donating at the following page: http://cablemodem.fibertel.com.ar/kani/donations.html

Last edited Aug 13, 2008 at 5:40 AM by javiercanillas, version 5