Umbraco7:在同一 Azure 存储帐户中设置多个 /media/ blob 容器

Umbraco7: Set up multiple /media/ blob containers within the same Azure Storage account

我们有多个 Umbraco 站点需要从 on-premise 迁移到 Azure Web 应用程序。

每个站点都有自己的 /media/ 文件夹,并且由于所有图像都需要大存储 space (~2gb) 和许多 read/write 操作,我们考虑使用 Azure 存储帐户通过Blob 容器解决方案。

使用单个 Azure 存储帐户通过 Blob 容器为所有站点的 /media 文件夹提供服务会降低成本而不是为每个站点使用单独的存储帐户是否正确?

我们找到了很棒的 UmbracoFileSystemProviders.Azure 包,但是找不到有关如何实现此 post 标题中所述内容的任何详细信息。

问题:我们如何在同一个 Azure 存储帐户中设置多个 /media/ blob 容器来服务多个 Umbraco 站点的图像?

您确实可以使用一个 Azure 存储帐户;只需为每个网站设置不同的 blob 容器——它们实际上不需要被调用 "media"。例如,我在以下示例中将 containerName 设置为 Site1Media

  <Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
<Parameters>
    <add key="containerName" value="Site1Media"/>
    <add key="rootUrl" value="https://youritteam.blob.core.windows.net/"/>
    <add key="connectionString" value="DefaultEndpointsProtocol=https;AccountName=[Account];AccountKey=[Key]"/>
    <!--
    Optional configuration value determining the maximum number of days to cache items in the browser.
    Defaults to 365 days.
  -->
    <add key="maxDays" value="365"/>
    <!--
    When true this allows the VirtualPathProvider to use the deafult "media" route prefix regardless 
    of the container name.
  -->
    <add key="useDefaultRoute" value="true"/>
    <!--
    When true blob containers will be private instead of public what means that you can't access the original blob file directly from its blob url.
  -->
    <add key="usePrivateContainer" value="false"/>
</Parameters>

Azure 存储的另一个特点是您只需为使用的数据付费;因此,设置多个存储帐户不会花费您额外的费用——为多个网站设置一个存储帐户可能没有什么好处;并且您以后可能会发现每个网站拥有一个存储帐户要容易得多 - 特别是如果您想将网站移动到另一个订阅下。