[英]Can not create a table in Azure storage emulator
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 存储模拟器没有运行。 请确保您已按照此处所述启动它。
基本上,您需要在程序中搜索“Windows Azure Storage Emulator”并启动它。 应打开一个控制台窗口,您可以在其中控制模拟器。
如果这有帮助,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.