Azure Cosmos DB: Build a .NET application using the Table API

You can follow the instructions here to get started. If you see something like “The remote server returned an error. (400) Bad request.” you can fix it by choosing one of the two options below.

 

Microsoft.WindowsAzure.Storage.StorageException occurred
  HResult=0x80131500
  Message=The remote server returned an error: (400) Bad Request.
  Source=Microsoft.WindowsAzure.Storage
  StackTrace:
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.Create(TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)
   at TableSBS.Program.Run(CloudTableClient tableClient, Int32 numIterations) in C:\Users\zxue\Downloads\azure-cosmosdb\PremiumTableGetStarted\Program.cs:line 70
   at TableSBS.Program.Main(String[] args) in C:\Users\zxue\Downloads\azure-cosmosdb\PremiumTableGetStarted\Program.cs:line 51

Inner Exception 1:
WebException: The remote server returned an error: (400) Bad Request.

 

1) Go to the Azure portal, create the “People” table and download the sample .NET app. It should just work because the app has the right connection string in the app.config file already.

image

 

2) Open “Manage NuGet Packages” window, remove WindowsAzure.Storage-PremiumTable and re-install it.

image