Blob service is a storage area of windows azure where we can store our text and binary data.
The Blob service stores text and binary data. The Blob service offers the following resources: the storage account, containers, and blobs. Within your storage account, containers provide a way to organize sets of blobs.
You can store text and binary data in either of two types of blobs:
· Block blobs, which are optimized for streaming.
· Page blobs, which are optimized for random read/write operations and which provide the ability to write to a range of bytes in a blob.
Now I am going to explain how to create blob service and how to add content in a blob in a windows azure application.
· Open Microsoft Visual Studio 2010 as an administrator.
· To create a new project File – New – Project.
· Select Cloud template from the Installed Templates.
· Select Windows Azure Project and enter the name of the project as BlobService.
· Click OK to proceed.
· To add an asp.net web role to the solution, choose ASP.NET Web Role and then choose the right arrow. The roles are displayed in the Windows Azure solution pane of the dialog box. You can rename it as QueueService.
· Click OK to add.
Now in order to add the Blob and its content in windows azure application, add the following code:
protected void Page_Load(object sender, EventArgs e)
containerPermissions= new BlobContainerPermissions();
// File from local storage.
Response.Write("File Uploadded successfully");
The above code add a mycontainer named blob in azure storage area on page load and also add a xml file (Student.xml) from local system as content of blob (mycontainer).
Now press F5 to run your application, The output should something like below if the file (Student.xml) was added successfully in a blob.
Now in order to watch the content of a blob, open Blobs section present in the Server Explorer
(Ctrl + W + L) and expand the Development section in Windows Azure Storage and also expand Blobs section, now double click on the blob (mycontainer). It will display all the content present in the blob at right side of the window.
I think after reading this article you can easily create blob service and store data in a blob in a windows azure application.