[This is prerelease documentation and is subject to change in future releases.]
The StorageClient sample provides Microsoft .NET wrapper classes for REST API operations for the Blob, Queue, and Table services. The sample also includes a console application that can be used to test the library functionality. This console application is built in C# and does not run in the fabric.
The StorageClient sample demonstrates the following features of the Windows Azure SDK:
-
Calling REST API operations against the Blob and Queue services
-
Using the .NET Client Library for ADO.NET Data Services to access the Table service
For detailed information on building and running the StorageClient sample, see the readme file in the StorageClient sample directory.
Goals of the Sample
The primary goals of this sample are:
-
To enable users of the Windows Azure SDK to quickly prototype applications and services that interface with storage services by using a .NET library, rather than having to implement the underlying REST protocols from scratch.
-
To aid users in building their own client libraries by providing them with a working example of an implementation of the REST APIs.
Note |
|---|
|
The StorageClient sample library is not optimized for performance and is not intended to be used for building robust services, but only as an example of a working client library. |
Sample Features
The main features of the sample client library are as follows:
-
The library implements REST API operations for the Blob and Queue services.
-
It supports retry semantics for the Blob, Queue, and Table service REST API calls, so that methods are repeatedly executed in the case of a retryable error condition.
-
It contains features for reading account information from configuration files.
-
It demonstrates how to authenticate requests against the storage services.
-
It implements helper functions for the Table service for:
-
Creating, deleting, and querying tables
-
Authentication
-
Error handling
Configuring Storage Endpoints
The StorageClient sample includes in the App.config file configuration settings that point to the endpoints of the storage services. By default these configuration settings point to the development storage endpoints. In the App.config file, they appear as shown in the following excerpt:
<configuration>
<appSettings>
<add key = "AccountName" value="devstoreaccount1"/>
<add key = "AccountSharedKey" value="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="/>
<add key="BlobStorageEndpoint" value="http://127.0.0.1:10000"/>
<add key="QueueStorageEndpoint" value="http://127.0.0.1:10001"/>
<add key="TableStorageEndpoint" value="http://127.0.0.1:10002"/>
…
</appSettings>
<configuration>
If you deploy the StorageClient sample to Windows Azure, you will need to modify these storage endpoints to point to the appropriate endpoints for the Windows Azure storage services in the cloud. You can set these in the App.config file or in the service configuration file (see Service Configuration File Schema).
There are two valid syntaxes for configuring production storage endpoints for the StorageClient sample:
-
The preferred approach is to omit the name of the storage account, which the StorageClient sample automatically appends if it is absent. Following this syntax, the storage endpoints will be:
-
http://blob.core.windows.net
-
http://queue.core.windows.net
-
http://table.core.windows.net
-
You can also include your account name in the storage endpoint. In the following example, replace myaccount with the name of your storage account:
-
http://myaccount.blob.core.windows.net
-
http://myaccount.queue.core.windows.net
-
http://myaccount.table.core.windows.net
If you include the name of your account, make sure that it matches the account name that appears in the Azure Services Developer Portal.
Retry Policies
The StorageClient sample demonstrates three retry policies. A retry policy specifies how the application will retry a request that has failed. The StorageClient sample includes the following retry policies; you can modify the sample to see each in action.
-
No retry
-
Retry at a specified interval
-
Retry at a randomized exponential interval, which may be configured within a minimum and maximum range.
See Also