【问题标题】:Can azure table storage be accessed from Web applications hosted on IIS可以从 IIS 上托管的 Web 应用程序访问 Azure 表存储吗
【发布时间】:2013-03-31 11:33:47
【问题描述】:

我有一个托管在 IIS 上的 Web 应用程序。我不想将其创建为 Web 角色。我仍然可以从 IIS 上托管的 Web 应用程序访问 Azure 表存储吗?

【问题讨论】:

    标签: azure-storage


    【解决方案1】:

    是的,你可以。只需在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);
    

    然后做你需要做的事情。您可以将 “UseDevelopmentStorage=true” 替换为适当的连接字符串,例如“DefaultEndpointsProtocol=http;AccountName=...;AccountKey=...”。您需要使用上传证书才能使用 https 连接。

    只要知道您需要为从 Azure 数据中心传出的所有数据付费。如果您有大量流量,我不建议您使用 Azure 存储作为您网站的主要数据存储解决方案。以 Web 角色或 Azure 网站托管您的应用程序肯定会更好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-06
      • 1970-01-01
      • 1970-01-01
      • 2021-09-19
      • 1970-01-01
      • 2014-11-06
      相关资源
      最近更新 更多