Windows Azure - access webrole local storage from separate workerrole
- by Brett Smith
I'm running an application on windows azure, the MVC views need to be dynamic, I started by storing them as records in the database, but am quite keen to move them to a physical location.
My concept was to create the physical file via code... which worked great and speeds up the page load dramatically. This was of course before I realised that the files were only available for the duration of the role
Next I looked at a start up task to create the files when the role was started - however I then realised that any separate instances weren't going to sync up unless I monitored the database for changes.
So I moved from a start up task to a function in the run method of the role that checks the database every 10 minutes to see if changes have occurred. The problem is that this seems to choke up the application (at least in the warm up stage).
Ideally I would like to move the run function to it's own worker role that can sit there and push files out to web role instances, but I'm unsure on how I would go about accessing the web roles local storage from the worker role. Can anybody tell me whether this is actually possible? and hopefully point me in the right direction to achieve this?
Just to clarify what I'm trying to achieve
-View is created in user interface running on web role and stored in database
-Separate web role (front end) has clientside application with virtualpath provider pointing Views requests to local storage (localresource)
-separate worker role to create View structure and load this into clientside web role local storage