我無法在本地計算機上創建名爲「people」的表。我通過啓動「Windows Azure存儲模擬器 - v2.2」來啓動Azure模擬器。我從NuGet 3.0.3.0版中提取了最新的Azure客戶端庫。 .NET版本是4.5,我的VS是2012 Ultimate。我從Windows 8.1在x64系統上運行此代碼。無法在Azure開發存儲上創建表
這是我的測試代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
namespace AzureTablesTest
{
class Program
{
static void Main(string[] args)
{
// Retrieve the storage account from the connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the table if it doesn't exist.
CloudTable table = tableClient.GetTableReference("people");
table.CreateIfNotExists();
}
}
}
我已經確定的是,仿真器通過檢查emualtor GUI運行:
當我從VS它運行測試代碼拋出此異常:
奇怪的是,當我打開Azure存儲資源管理器時,創建一個開發帳戶,我可以創建表和實體。當我從Emulator GUI重置表時,我可以看到存儲資源管理器也被清空(刷新後)。我試圖通過資源管理器創建一個表格,並查看在使用上面的簡單控制檯程序創建表格時是否出現了任何錯誤,並且出現同樣的錯誤。所以我無法使用控制檯程序讀取或寫入,但我可以使用資源管理器。
有人知道我爲什麼不能通過我的簡單控制檯程序創建表,但爲什麼我可以通過Azure存儲資源管理器?我甚至試圖以VS管理員身份運行上面列出的控制檯程序,這給了我如上所示的完全相同的錯誤。
UPDATE 安裝存儲模擬器2.2.1預覽,因爲這個鏈接描述Azure 400 Bad Request on every request,解決了我的問題。
這是存儲模擬器2.2的已知問題。請參閱此主題以獲取更多信息和解決方案:http://stackoverflow.com/questions/20284787/azure-400-bad-request-on-every-request/20284900#20284900。 –
哦,我已經完全閱讀了這篇文章,但我認爲它已經修復了。我會試試這個。謝謝分配! – mslot
@GauravMantri,如果你想你可以回答我的問題。否則我會自己回答。所以我可以關閉它。 – mslot