Try our conversational search powered by Generative AI!

Azure Blob Storage configuration not working in DXP

Vote:
 

Hi, I configured Azure blob storage as a storage provider for a CMS 12 as per the Episerver documentation on How to add Azure Blob provider to your .net core application. The application is working fine in my local but somehow in DXP, it is using Built-in storage provider "App_Data" instead of using Azure blob storage even those these changes are deployed. We are using the Deployment API method for deployment.

Does it require any additional configuration to work in DXP? Or do we need to configure somehow that this is the default provider?

 

#272208
Edited, Feb 15, 2022 5:51
Vote:
 

Hi Praveen

Sounds like the DXP blob provider configurations are not being applied correctly. Could also be that you configured your local blob provider in such a way that DXP cannot override it on start-up.

Did you configure the blob provider in appsettings.XXX.json or in your Startup.cs file?

#272218
Feb 15, 2022 12:37
Vote:
 

Hi Stefan, 

I configured it in my startup.cs file like this as per the documentation. 

           services.AddAzureBlobProvider(o =>
             {
                 o.ConnectionString = "My Connection String";
                 o.ContainerName = "My Container Name";
             });
Do I need to add any more to this to work in DXP?
#272219
Edited, Feb 15, 2022 12:42
Vote:
 

That's probably the reason. Ideally you would add this to your Startup.ConfigureServices method. And that will solve it all in DXP.

// Make sure to inject IWebHostEnvironment in the Startup constructor.
if (!_webHostingEnvironment.IsDevelopment())
{
    services.AddCmsCloudPlatformSupport(_configuration);
    // If you have a Commerce site, add this too.
    services.AddCommerceCloudPlatformSupport(_configuration);
}

In appsettings.Development.json, you can put your local blob provider and connection strings etc.

#272220
Feb 15, 2022 12:46
Vote:
 

Currently My Startup.ConfigureServices is like this

       public void ConfigureServices(IServiceCollection services)
        {
            if (_webHostingEnvironment.IsDevelopment())
            {
                services.AddControllersWithViews().AddRazorRuntimeCompilation();
                services.AddControllersWithViews();
            }
            else
            {
                services.AddCmsCloudPlatformSupport(_configuration);
            }
           services.AddAzureBlobProvider(o =>
             {
                 o.ConnectionString = "My Connection String";
                 o.ContainerName = "My Container Name";
             });
        }
So if I understand what you said correctly I need to remove the 
 services.AddAzureBlobProvider(o =>
             {
                 o.ConnectionString = "My Connection String";
                 o.ContainerName = "My Container Name";
             });
From here and add the environment-specific configurations through appsettings.Development.json, appsettings.Integration.json files. Right? If yes can you also please share how to configure this through appsettings file. I found this in documentation but really confused about the values to supply for azure case
{ "EPiServer" : { "Cms" : { "BlobProvidersOptions" : { DefaultProvider": "Custom", "Providers" : { "Custom" : "CustomProvider, Customassembly" "Another" : "Another_CustomProvider, Customassembly" } } } } }
#272223
Feb 15, 2022 13:13
Vote:
 

Yes, AddAzureBlobProvider is implied when using AddCmsCloudPlatformSupport, with configurations provided by Optimizely DXP. Besides, it should only be used in DXP (ie. Development).

This is a sample of a appSettings.Development.json file:

{
    "EPiServer": {
        "Cms": {
            "BlobProviders": {
                "DefaultProvider": "FileBlobProvider",
                "Providers": {
                    "FileBlobProvider": "EPiServer.Framework.Blobs.FileBlobProvider, EPiServer.Framework"
                }
            },
            "EventProvider": {
                // On local development machine we don't care about other local sites' events.
                // Not that it matters, though, as there is no default event provider in CMS 12.
                "Provider": "EPiServer.Events.Providers.Internal.NullEventProvider, EPiServer.Events"
            },
            "FileBlobProvider": {
                // Could also be a network UNC path for shared blob folders.
                "Path": "C:\TEMP\Blobs\Project1"
            }
        }
    }
}
#272224
Feb 15, 2022 13:30
Pär Sandgren - Apr 05, 2022 7:56
This configuration snippet should really be added to the documentation, to clarify how to use different configurations for local dev and DXP.
Linda Mohacsi - Sep 20, 2023 10:08
I agree with Pär! The documentation is lacking there.
Thank you for this post, it helped me get past this problem in my dev environment.
Vote:
 

Hi Stefan,

I am in process of migrating CMS11 to CMS12.

My CMS11 application blobs saved into network location and i have configured as per your suggestion blobs path but assets are not loading up.

Tried with json settings and from startp code (services.AddFileBlobProvider("FileBlobProvider", "\\XX.XX.XX.XX\\Shared\\BlobsData");) file as well but same issue.

All images were saving into different path (i.e. {web project folder}/app_data/blobs) , when i upload the image after upgrade the solution.

Can you please let me know your suggestions ?

Thanks,

Suresh B

#276843
Mar 22, 2022 7:24
Vote:
 

You need to set the app data path either way

{
  "EpiServer" : {
    "CMS" : {
      "Environment" : {
        "AppDataPath": "\\XX.XX.XX.XX\\Shared\\BlobsData
      }
    }
  }
}

or

services.Configure<EnvironmentOptions>(x => x.AppDataPath = "\\XX.XX.XX.XX\\Shared\\BlobsData")
#276888
Mar 22, 2022 16:15
Vote:
 

Hi Mark,

Thanks for the update.

But still blobs were not showing up. 

I have modified as per above, But the same folder structure was created with image in my local system (where i am running the application) instead of network path. Please refer screenshot example.

#276910
Mar 22, 2022 17:00
Vote:
 

Just a guess, but is it possible you need two more slashes at the beginning of that path to indicate it's a network share path?

services.Configure<EnvironmentOptions>(x => x.AppDataPath = "\\\\XX.XX.XX.XX\\Shared\\BlobsData")

(where "xx.xx.xx.xx" is replaced by the IP or network path)

I think that should translate to the path: \\XX.XX.XX.XX\Shared\BlobsData 

#276917
Mar 22, 2022 18:15
Vote:
 

Hi Daniel,

It worked, Thank you for support.

Thanks,

Suresh B

#276971
Mar 23, 2022 3:12
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.