I have a C# Class Library that is being compiled into several applications, all of which are hosted as ASP.NET 4.0 WebForm and/or MVC Cloud Services on Azure. I would like to centralize this library so that any updates to the package does not require compiling and deploying each project every update cycle.
Obviously I have the option to create a WCF service, however that would require that I refactor both the class library as well as each project using it to become consumers of a service, and due to the complexity of the system, this may take several months and is not an option for the short term.
Since all my projects are in the same Affinity Group on Azure, is there an alternative to centralizing this DLL and it’s methods for all projects to share? I couldn’t find anything online so I am hoping to get some good options and thought starters from the community. Please let me know if I left any details out.
How about storing the shared DLL’s in blob storage, in the same data center? On role startup, each instance would download the latest DLL to its local storage (in the app’s root or some other folder where it needs to be).
Within the same data center, bandwidth between blob storage and your role instances is free, and 100Mbps x # of cores, so it’s very quick. And, to update a DLL, you only need to upload it to one place (the blob container).
Upon updating one of the DLLs, you’d need to signal your role instances to either recycle (the safest method), or update themselves with the latest DLL. You can’t have a “blob watcher” like you would have a file watcher (hence the suggestion of sending a signal). Alternatively, you can have some type of background thread checking a “dll” container every few minutes and, when spotting one that’s changed, trigger the update locally.
One word of caution: If you update your DLL, and each role instance is polling for changes (or gets signaled to recycle), just be careful not to recycle all instances at the same time. Otherwise you’ll be left with a service that’s temporarily unavailable.