1
我有一個託管在IIS上的Web應用程序。我不想將它創建爲Web角色。我仍可以從IIS上託管的Web應用程序訪問Azure表存儲嗎?可以從託管在IIS上的Web應用程序訪問Azure表存儲器
我有一個託管在IIS上的Web應用程序。我不想將它創建爲Web角色。我仍可以從IIS上託管的Web應用程序訪問Azure表存儲嗎?可以從託管在IIS上的Web應用程序訪問Azure表存儲器
是的,你可以。只要抓住上NuGet在Windows Azure存儲包,然後做這樣的事情:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
// Create the table client
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the table if it doesn't exist
string tableName = "people";
tableClient.CreateTableIfNotExist(tableName);
然後做你需要做什麼都。您可以用「DefaultEndpointsProtocol = http; AccountName = ...; AccountKey = ...」等正確的連接字符串替換「UseDevelopmentStorage = true」。您需要使用上傳證書才能使用https連接。
只要知道您將收取Azure數據中心以外的所有數據。如果您擁有大量流量,我不建議將Azure存儲用作您網站的主要數據存儲解決方案。這肯定會更好地將您的應用程序託管在Web角色或Azure網站中。