Configuring 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:
Setting 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:
FileSystemas your default asset provider in the line 2.
RootPath, provide the base path to the
wwwrootdirectory inside app folder in the line 4.
- 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.
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.
This mode is good for local development purposes and not recommended for production due to lack of scalability.
Setting up Azure Blob Storage in Production Mode¶
To set up Azure blob storage:
Create Azure blob storage according to this quick start guide by Microsoft.
Add the connection string under the
AzureBlobStorageas your default asset provider in the line 2.
ConnectionString, provide the connection string of your storage account.
You can get your connection string from your Azure Portal under the Access Keys section.
This mode is recommended for using in production environment since it enables sharing the asset storage across multiple platform instances.