Is it needed to code to save my images/files into blob storage if i use windows azure?
-
2012年7月3日 13:30
Hi
Is it needed to change code to save my images/files into blob storage if i use windows azure?
Currently i coded as to store into my local application folder.
すべての返信
-
2012年7月3日 13:41モデレータIf you're using Windows Azure Cloud Services (the only app hosting option available in Windows Azure until last month), then yes. But if you're using Windows Azure Web Sites or Virtual Machines, then no. The local folder/drive will be persisted behind the scenes for you into Azure Storage.
- 編集済み BrentDaCodeMonkeyModerator 2012年7月3日 13:41
-
2012年7月3日 13:47
In short - yes. Saving to blob storage will insure persistence of the files, and the ability to access files from multiple instances.
You could also use Windows Azure Drive or local storage. Using Azure Drives will let you continue to use normal System.IO classes to work with the files, but some code would need to change to reference the Azure drive. Only one instance at a time can use (write to) the Azure Drive as well.
If using local storage, small code changes would be necessary too. Windows Azure diagnostics could be used to periodically transfer files from local storage to Windows Azure blob storage.
You have options, but if you want file persistence then some code changes will be necessary.
The above applies to web & worker roles. If you look at the new (preview) Virtual Machines, then no code changes would be necessary. Pros and cons to both approaches. ;)
-
2012年7月3日 13:51
Ya i am using cloud service only. If it is the need to change my code means can you share the code?
Ok. Just assume i changed the code to save my images into blob storage. And i added some more images to my application. Then i try to view those blob storage files via some third party tool like nudesc. But i could not find anything inside blobs. Its fully empty? why?
-
2012年7月3日 13:54There are great samples of saving files to blob storage in the Windows Azure Training Kit - http://bit.ly/WATKJune2012. Check out the Guestbook sample.
-
2012年7月3日 23:27
Hi, thanks for the question! Blob storage is great for storing images/files needed by your application, for the reasons discussed by others - access by multiple clients, durability, scalability, etc. You can view a "Getting started" guide for blob storage here: http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/. If you are using a language other than .NET, just choose a different language across the top of the page and select "Blob Service" from under "How To Guides" in the left side of the page.
However, I wanted to ask a question about your scenario: are these just static images that you use as part of a web site you host? That is, do they only change when you do a deployment? If that's the case, then including them as part of your deployment is a fine option, and will result in the files stored on the local file system of each of the instances your application is deployed to. But if these files change after deployment (for example, users can upload/edit them), then yes - blob storage is probably your best option, and is quite easy to use. Even if the files are static, often blob storage gives you flexibility that deployment won't (you can change the images without doing a new deployment, for example). Additionally, it allows you to keep your deployment package smaller if you're worried about that.
Let me know if you have any further questions!
-Jeff
- 回答としてマーク Basant Nair 2012年7月6日 5:48

