Windows azure platform articles
This chapter is closely related to the storage service details of Windows azure platform (13) Windows azure blob Storage Service (I) in the previous chapter. Please read the previous content first.
The previous chapter describes how to use blob storage to store images on a local simulator.
This section describes how to use blob storage to store images on the Windows azure platform.
1. log on to the user management page
Please log on to the administration site: https://windows.azure.com first
SelectManaged Services, storage accounts, and CDN-->Storage account --> Create storage account
A new storage account window will pop up, select subscription, and enter the URL (the system will automatically prompt you once the URL is renamed). Here I enter threestone, next, select the data center we need. Here we select the data center in East Asia, that is, Hong Kong. Finally, select "OK ".
After 1-2 minutes, the storage account can be created, for example:
We know that Windows azure storage service has three types: blob, table and queue)
Observe that the URLs of these three types of storage are listed in the List attribute on the right. We can access these three types of storage services through rest APIs.
Windows azure's access to Azure storage is controlled by the storage account and primary access key (secondary access key.
That is to say, as long as you know your own account (or others') storage account and master access key (secondary access key), you can use the azure storage service normally.
You can click the View button to view the access key. The following form is displayed, showing the master access key and the secondary access key.
You can copy the content of the CMK (or CMK) to the clipboard. (For security reasons, I have hidden some of the security key content. you can create your own storage account on the Windows azure user management interface .)
2. Open the previous azureblobstorage Project (download from here)
Select webrole --> right-click --> attribute
Select "Settings" in the list on the left, and modify dataconnectionstring (type or connection string is not modified). In the value column, select the rightmost "..." button.
In the pop-up window, enter the account name in the threestone we created on the user management interface, and paste our primary access key (or secondary access key) in the account key ). Finally, select "OK ".
Modify Microsoft. windowsazure. plugins. Diagnostics. connectionstring in the same way, as shown in figure
Save the entire project and re-compile it. Finally, package the entire project and click package:
The folder is displayed, which contains two files with the suffixes cspkg and cscfg. Do not close the folder window first.
3. Create a Windows azure hosting service
Go back to the Windows azure user management page and select "managed services, storage accounts, and CDN" --> "managed services" to view the web site leihelloazure we created in chapter 10.
Here we want to create a new windows azure hosting service. We choose to create a new hosting service:
We create a new hosting service named leiazureblob, which is located in the East Asia (Hong Kong data center). We select "Do not deploy" as the deployment option to directly create this site.
After the creation, we can see the hosting service site leiazureblob. We select this hosting service and click Create production deployment at the top.
Enter the deployment name in the pop-up form. I named blobstorage differently from the managed service, and then browsed the package location (cspkg file) and configuration file (cscfg) files locally. Finally, select OK.
Wait about 5 minutes (normally), and my leiazureblob hosting service will be created.
Some readers may wonder why the first leihelloazure example we made earlier looks different from the hosting service of leiazureblob?
Yes, because previously we set leihelloazure's instance count to 3, while azure blob uses the default settings, and instance count is 1.
Then we open http://leiazureblob.cloudapp.net/to test the success of uploading a photo.
You can also use Server Explorer of Visual Studio 2010 to view images uploaded to Windows azure storage.
In add new storage account, enter the storage account and master access key we created on the azure management interface:
Expand windows azure storage --> threestone --> blobs --> galleryto see the original azure.jpg photo.
Gallery is set in local serviceconfiguration. cscfg.
Right-click azure.jpg and choose --> properties to view the URL of the image.
We can see that this local image has been uploaded to the data center I created in East Asia (Hong Kong), and we can access this image resource through this URL.