ImageSharp Cache folder not being created in Azure...
# help-with-umbraco
d
I am running Umbraco V10 and I am trying to configure Azure Blob storage to store media in a load balanced environment. I have followed this: https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/extending/filesystemproviders/azure-blob-storage https://github.com/umbraco/Umbraco.StorageProviders/blob/support/10.0.x/README.md#folder-structure-in-the-azure-blob-storage-container However the cache folder is not getting generated. It works fine in a non load balanced environment. Any suggestions what might be the issue? I have tried: 1. Restarting the app service 2. Deleting the umbraco/Data/Temp folder
s
Do your container names match and the container has the right privelege?
d
I rechecked the container names, they seem to be right. Is there anything else I might be doing wrong?
m
Maybe... if you installed the latest version of the StorageProvider then you need two packages now.
Copy code
.AddAzureBlobMediaFileSystem()
       .AddAzureBlobImageSharpCache()
d
Hi @Mike Chambers @Sean Thorne
Im using SixLabors.ImageSharp.Web v3.1.0 and Umbraco.StorageProviders.AzureBlob v10.0.0. The umbraco version is 10.5.1 I followed the steps mentioned in this article https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/extending/filesystemproviders/azure-blob-storage.
Copy code
public void ConfigureServices(IServiceCollection services)
        {
            services.AddImageSharp();
            services.AddUmbraco(_env, _config)
                .AddBackOffice()
                .AddWebsite()
                .AddComposers()
                .AddAzureBlobMediaFileSystem()
                .Build();          
        }

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHttpContextAccessor httpContextAccessor, SmidgeHelper smidgeHelper)
        {
            if (env.IsDevelopment())
            {
               
                app.UseDeveloperExceptionPage();

            }
            else
            {
                app.UseExceptionHandler("/500.html");
                app.UseRewriter(new RewriteOptions().AddIISUrlRewrite(env.ContentRootFileProvider, "IISUrlRewrite.xml"));
                app.UseStaticFiles();
            }
            app.UseImageSharp();
            app.UseUmbraco()
                .WithMiddleware(u =>
                {
                    u.UseBackOffice();
                    u.UseWebsite();
                })
                
        }
This works fine in a non load balanced environment but does not generate the cache folder in the load balanced setup. Any thoughts please?
m
Might not be related but did you do the loadbalanced setup with explicit election of publisher (single) vs subscribers (multiple) and only allow umbraco editing on the single instance backoffice? Along with the changes to temp, and lucene settings? 😉 Also I wouldn't ordinarily have
addImageSharp()
in startup as the umbracoBuilder already has that.. https://github.com/umbraco/Umbraco-CMS/blob/release-10.5.1/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilder.ImageSharp.cs#L20 https://github.com/umbraco/Umbraco-CMS/blob/release-10.5.1/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilderExtensions.cs#L296 But as you say it's working locally then doesn't sound implementation issue.. more a configuration issue on the production server? Is it all cache images arent' created from frontend or back-office and on all the loadbalanced instances? (could it be an appsetting override that has been missed/incorrect on subscribers for instance?)
d
Hi @Mike Chambers
Yes I have implemented explicit election of publisher (single) vs subscribers (multiple). I have the following settings in appsettings.json for lucene and temp Publisher:-
Copy code
"LocalTempStorageLocation": "EnvironmentTemp"
 "Examine": {
        "LuceneDirectoryFactory": "SyncedTempFileSystemDirectoryFactory"
      },
Subscriber:-
Copy code
"LocalTempStorageLocation": "EnvironmentTemp"
 "Examine": {
        "LuceneDirectoryFactory": "TempFileSystemDirectoryFactory"
      },
Yes it looks like more a configuration issue but I'm unable to figure out what might be causing this issue. The cache folder corresponding to the media folder is not getting generated in the Azure container. As a result some of the images on the frontend are not cropped properly. Any thoughts? Am I missing any configuration setting?
@Mike Chambers @Sean Thorne Wuhoo!!! I have finally found the issue. The issue was caused by the following line in Startup.cs
Copy code
app.UseStaticFiles();
Removing the above line of code makes the imagesharp cache work. Anybody else have encountered this issue? Any idea why having the app.UseStaticFiles() would break the imagesharp cache?
m
Maybe same as my previous comment.. re UmbracoBuilder is already adding some of this for you.. so you should add you requirements via extensions to the already configured package? https://github.com/umbraco/Umbraco-CMS/issues/12666#issuecomment-1238008936 https://github.com/umbraco/Umbraco-CMS/issues/12666#issuecomment-1238082198 that discussion ends up with a KB article https://docs.umbraco.com/umbraco-cms/reference/response-caching
d
@Mike Chambers Yes may be there is no need to explicitly add
Copy code
app.UseStaticFiles();
Its a bit unusual that if UmbracoBuilder is already adding it then why its mentioned in this doc https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/reference/routing/iisrewriterules to add it for rewrites to take effect. Thanks @Mike Chambers for your inputs on this. Really appreciate 🙂