In Azure, Where should I store physical files that need to be accessed by a Worker Role?
In my case I would normally store these particular files in my Web Role's App_Data folder but I don't believe that Worker Roles can access that folder.
In Azure, Where should I store physical files that need to be accessed by a Worker Role?
In my case I would normally store these particular files in my Web Role's App_Data folder but I don't believe that Worker Roles can access that folder.
If you place your files in Windows Azure Storage (blobs are good for file storage), any of your role instances can access them, whether in Web Roles or Worker Roles. Also, Blob storage is durable meaning triple-replicated within the data center (and geo-replicated to another data center).
Regarding Worker Role instances not being able to access folders in a Web Role instance (or another Worker Role's instances), you're right. In fact, multiple instances of the same Role cannot access each other's file system (just remember that a Role is just Windows 2012 Server, and each instance of that Role runs in its own VM with its own local disks).
EDIT JULY 5 2014 This answer is now a bit old. Azure now offers a File Service, providing SMB shares which are backed by blob storage. This tends to be easier to work with for legacy applications that must use a file system and cannot be altered to directly read from / write to blobs. More information may be found here.
Since data isn't persisted on the instances you'll need distributed storage where you can store your files (and other data). This can be done by using the Windows Azure Blob Storage (and this is very cheap compared to storing your files in SQL Azure).
Azure storage is a good option. You can also look at using Local Storage Resources:
http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx
A local storage resource is a reserved directory in the file system of the virtual machine in which an instance of a role is running. Code running in the instance can write to the local storage resource when it needs to write to or read from to a file. For example, a local storage resource can be used to cache data that may need to be accessed again while the service is running in Windows Azure.
If the data you are storing is sensitive - make sure you use some protection scheme on your blob container and don't just store the blob data as a publicly accessible link where anyone could view it. Your best bet is using SaS (Shared Access Signature) to securely access your stored Azure blob data. If the data isn't sensitive - this isn't required.
See further MSDN reference on Securing Blobs & Containers in Azure.
© 2022 - 2024 — McMap. All rights reserved.