我想添加一行到天藍色的表存儲。這是我第一次與這個工作,所以我跟着一個MS教程,不幸的是他們使用控制檯應用程序,而不是MVC,所以我不得不湊合一點,基本上,當[httpPost]
添加到我的AddRow
方法我得到一個HTTP 404錯誤「在 '/' Application.The資源服務器錯誤無法找到「不能找到方法:使用MVC的httppost將行添加到天藍色表存儲
代碼(裏面的HomeController):
[HttpPost]
public ActionResult AddRow()
{
ViewBag.Message = "Your application description page.";
try
{
CloudStorageAccount cloudStorageAcc = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudTableClient cloudTableClient = cloudStorageAcc.CreateCloudTableClient();
CloudTable table = cloudTableClient.GetTableReference("Users");
table.CreateIfNotExists();
Insert inserter1 = new Insert("Bob", "Contoso");
inserter1.UserName = "Bobbie";
TableOperation insertOperation = TableOperation.Insert(inserter1);
table.Execute(insertOperation);
}
catch
{
return View();
}
return View();
}
我嘗試mysite.azurewebsites.net/Home/AddRow訪問此