How do I deploy a native code library dependent on

2019-05-31 16:05发布

问题:

This guide shows how to deploy a COM object consisting of a single .dll file to a Windows Azure role using the start-up task mechanism.

Now I have a COM object that depends on several hundred other files - .dll files (I build them myself as well) and some binary data required for its operation that need to be deployed as a directory tree. Including that into the role project (as it is done for the single file in the guide) seems rather dumb - those files don't belong to the role functionality, instead the role just depends on the COM object.

How do I deploy a huge subtree containing the COM object and whatever it depends on onto Windows Azure most conveniently?

回答1:

One popular technique is to store those files in blob storage. Two ways to do this:

  1. Create a container for your DLL and dependent files, and store each file in its own blob.
  2. Create a zip file of your DLL and dependency tree, and store that zip in a single blob

With an elevated startup task, you can copy down the file(s) and install your COM component.

Option #2 will likely result in a quicker bootup time, since it's a single copy, and it will have less storage transactions. You'll just need to bundle a zip application (or store that in a separate blob.

Nate Totten built a multi-tenant web role for Windows Azure, and the technique he uses for deploying a website involves option #2 above (although not as a startup task). I suggest looking at that project to see how the zip file is copied to local storage and unzipped.

EDIT: One more option is to look at AzureRunMe, an open source tool for unzipping and launching apps in a Windows Azure role.



回答2:

If the files are going to change independently of the change process on the role, then I would agree with David's suggestions - I would put them all in a zip in Blob Storage and then use a startup task to download and install the files.

However, if the files are not going to change independently of the files in the role, then I would package the files in a .zip and then run a startup process to unzip and install those files from the role. One of the advantages of this approach is that the project is very straight-forward to deploy and version in "devops" - it doesn't have any dependencies on Blob storage.

One final option is that you could also put the DLLs in an Azure Drive - you could mount that drive and install the COM object from that drive during role startup.