【发布时间】:2016-11-02 20:01:31
【问题描述】:
我正在关注 this 教程,该教程是关于 Table Storage Service 的。我正在使用本教程的模拟器版本,您可以在“使用云服务时配置连接字符串”段落的第 5 点找到该教程。
这是我粘贴在“关于”ActionResult 中的代码:
public ActionResult About()
{
// Retrieve the storage account from the connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the CloudTable object that represents the "people" table.
CloudTable table = tableClient.GetTableReference("people");
// Create a new customer entity.
CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
customer1.Email = "Walter@contoso.com";
customer1.PhoneNumber = "425-555-0101";
// Create the TableOperation that inserts the customer entity.
TableOperation insertOperation = TableOperation.Insert(customer1);
// Execute the insert operation.
table.Execute(insertOperation);
return View();
}
在这一行 table.Execute(insertOperation); 我收到以下错误消息:
StorageException 未被用户代码处理 远程服务器返回 错误:(404) 未找到。
我使用的项目模板是“Windows Azure 云服务”。弹出的下一个窗口,我只添加了“ASP.NET MVC 4 Web Role”。
有人知道是什么导致了这个错误吗?
【问题讨论】:
标签: http-status-code-404 azure-storage azure-table-storage