2017-01-10 51 views
1
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.Azure; // Namespace for CloudConfigurationManager 
using Microsoft.WindowsAzure.Storage; // Namespace for CloudStorageAccount 
using Microsoft.WindowsAzure.Storage.Table; // Namespace for Table storage types 


namespace ConsoleApplication1 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 

      try 
      { 
       // Retrieve the storage account from the connection string. 
       CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
        CloudConfigurationManager.GetSetting("StorageConnectionString")); 

       // Create the table client. 
       CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); 

       // Retrieve a reference to the table. 
       CloudTable table = tableClient.GetTableReference("Demo"); 

       // Create the table if it doesn't exist. 
       table.CreateIfNotExists(); 
       Console.WriteLine("Succ"); 
      } 
      catch (Exception ex) 
      { 
       Console.WriteLine(ex); 
       Console.ReadKey(); 
      } 
     } 
    } 
} 

我們正試圖在Visual Studio 2015中運行此代碼。我們在創建Azure存儲模擬器中的表時遇到錯誤。無法在Azure存儲模擬器中創建表

Getting this error while executing above code..

+0

您是否在運行Storage Emulator? – juunas

+0

請確保存儲模擬器正在運行。根據錯誤,仿真器似乎沒有在您的機器上運行。 –

回答

0

好像Azure存儲模擬器沒有運行。請確保您已按照here所述啓動它。

基本上,您需要在程序中搜索「Windows Azure存儲模擬器」並啓動它。控制檯窗口應該打開,您可以控制模擬器。

讓我知道是否有幫助。