Reputation: 26171
I'm trying to host some static files for access by an ASP.Net web role and a separate data worker role that are both running on the same deployment (they use a global static interface).
However, I'm unsure how exactly to 'host' them, I've tried using virtual folders via HttpRuntime.AppDomainAppPath
, but it only occasionally works in debug mode. The files also don't seem to get packaged into the deployment packages made by VS vis CSPack (though this might be a separate issue, is it possible to fix this too?)
The static files in question are actually WordNet, which I'm using through WordNet.Net, If that makes any difference. I also need the solution to work in both the cloud deployment and the emulator (if possible).
Upvotes: 1
Views: 434
Reputation: 71091
If the files are simply read-only, you can place them in an Azure Drive, which is essentially an NTFS-formatted vhd stored in a Page Blob (see here for more info). Each of your role instances may mount a read-only snapshot of this drive (and one instance may gain write-access at a time).
Storing files on a local disk won't work, because those files aren't replicated across instances; each instance has its own attached storage.
A common pattern is to store content in blobs, possibly in a ZIP file, and then copying those files from Blob Storage to local disk upon instance startup. As an example, you can grab Nate Totten's Azure Accelerator for Web Roles. You'll see the ZIP file copy technique in action, as it extracts entire websites and unzips them into virtual directories.
Upvotes: 2
Reputation: 2363
The files may not be being packaged if you haven't set the 'Copy to output directory' property to 'Copy if newer' / 'Copy always'.
Upvotes: 0