Skip to content
Last update: August 24, 2024

Configure Asset Blob Storage

Blob is an abstraction that works as a single point of access to all media files in your online store. Such files could be product images or attachments, PDF specs, etc., regardless of their location or protocol.

By default, the platform allows you to configure one of the following blob storage providers:

Set up FileSystem asset storage in development mode

The FileSystem provider uses the local file system to store and provide public access to all media files. This mode implements Static files in ASP.NET Core with all files stored within the app local directory. The FileSystem storage provides public access to the files via relative URIs.

To switch platform to using this provider, edit the Assets section of the appsetting.json file:

  1. Specify FileSystem as your default asset provider in the line 2.
  2. For RootPath, provide the base path to the wwwroot directory inside app folder in the line 4.
  3. Provide the base URL that will be used when generating a public URI ASP.NET Core app serves directly in the line 5. Make sure both host and port are up-to-date and valid for your platform instance.
appsettings.json
"Assets": {
    "Provider": "FileSystem",
    "FileSystem": {
        "RootPath": "~/assets",
        "PublicUrl": "https://localhost:5001/assets/"
    }
},
Example

You have an image file named MyImage.jpg. It is stored at wwwroot/assets/MyImage.jpg. This file will be accessible through https://localhost:5001/assets/MyImage.jpg (a public URI), since ASP.NET marks all files in wwwroot as servable.

Note

This mode is good for local development purposes and not recommended for production due to lack of scalability.

Set up Azure Blob Storage in production mode

To set up Azure blob storage:

  1. Create Azure blob storage according to this quick start guide by Microsoft.

  2. Open appsettings.json.

  3. Add the connection string under the Assets section.

    1. Specify AzureBlobStorage as your default asset provider in the line 2.
    2. In ConnectionString, provide the connection string of your storage account.

      appsettings.json
      "Assets": {
          "Provider": "AzureBlobStorage",
          "AzureBlobStorage": {
              "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=<media account name>;AccountKey=<media account key>;EndpointSuffix=core.windows.net"
          }
      },
      

Tip

You can get your connection string from your Azure Portal under the Access Keys section.

Note

This mode is recommended for using in production environment since it enables sharing the asset storage across multiple platform instances.