上传数据到Windows Azure时收到409错误
本文关键字:错误 Windows 数据 Azure | 更新日期: 2023-09-27 18:02:13
我试图上传一些数据到我的Windows Azure存储帐户,并在执行代码时遇到异常。例外情况如下:
类型为"Microsoft.WindowsAzure.Storage"的异常。在Microsoft.WindowsAzure.Storage.dll中发生了"StorageException",但未在用户代码中处理。附加信息:远程服务器返回了一个错误:(409)Conflict.
这是我的代码,每次我尝试,Visual Studio总是告诉我它在不同的地方坏了。
// Retrieve storage account from the connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the table if it doesn't exist.
CloudTable table = tableClient.GetTableReference("articles");
table.CreateIfNotExists();
// Create a new article entity.
Article neumeier = new Article("Israel will strike Iran in the next 5 years", "NeumeierJ.R");
neumeier.User = "NeumeierJ.R";
neumeier.Tagline = "Israel will strike Iran in the next 5 years";
neumeier.UserCredentials = "Founder of Codex.Library";
neumeier.UserEmail = "NeumeierJ.R@outlook.com";
neumeier.Author = "Chomsky";
neumeier.AuthorCredentials = "Everyone knows Chomsky...";
neumeier.Category = "LD2015";
neumeier.Citation = "CNN or something like that.";
neumeier.Content = "It is inevitable that Israel will attack Iran, or vice versa. In the hotbed of conflict in the MidEast.";
// Create the TableOperation that inserts the article entity.
TableOperation insertOperation = TableOperation.Insert(neumeier);
// Execute the insert operation.
table.Execute(insertOperation);
// End Azure Test
我应该使用所有正确的引用和使用语句…
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Auth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Claims;
using System.Web.Http;
using System.Configuration;
很抱歉格式不好,第一个问题。任何帮助将是伟大的,谢谢!
分区键+行键一起作为表中该条目的主键,这个组合必须是唯一的。只要不违反PK+RK=unique约束,就可以在单个分区中拥有几乎无限数量的rowkey。但是我看到你没有指定分区键和行键