Question

I have a local storage folder, called TempStore, set up on my Web Role instances.

Is it possible to expose files as a URI from my local storage?

E.g:

http://myapplication.cloudapp.net/TempStore/helloworld.jpg

I understand that I could use blobs for this, but I would prefer to use local storage in this case.

Was it helpful?

Solution

There is. However I really do not understand the reason for doing this? The only reason I see is some misunderstanding or not fully understanding the capabilities of the Windows Azure Platform Services (Storage, Cloud Service / Web Roles).

You have to know that local storage is not synced between role instances. Also if hardware failure happens, a role healing process will instantiate an entirely new VM with fresh image from your cloud service package. This will lead to an absolutely empty local storage resource. Windows Azure Load Balancer (the thing that sits in front of your web and worker roles, more here) uses Round Robin algorithm. Meaning that even if with one request user uploads file to your web role. The next request (that you will probably want to show preview) might go to another instance that has no idea of user uploaded.

If, after knowing all these facts, you still want to "shoot yourself in the foot" here is the solution:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top