Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John 7 posts 108 karma points
    Oct 25, 2023 @ 14:25
    John
    0

    Errors in AddUmbraco() and UseUmbraco() after setting up Azure Blob storage

    I'm working on a new site in v12.

    After following the steps to set up blob storage on Azure (this article), I received "Exited with error code -2146232797" when trying to launch the site.

    Startup.cs errors on services.AddUmbraco() saying that 'IServiceCollection' does not contain a definition for .AddUmbraco().

    app.UseUmbraco() also now errors stating that 'IApplicationBuilder' does not contain a definition for UserUmbraco()

    I'm unsure how to debug this one.

  • Stuart Paterson 58 posts 229 karma points
    Nov 03, 2023 @ 12:27
    Stuart Paterson
    0

    Would you be able to post the contents of your Startup.cs to take a look?

    I have Azure Blob storage working on 3 v10 sites so hopefully can help in some way if you're still having an issue.

    Stuart.

  • John 7 posts 108 karma points
    Nov 03, 2023 @ 13:21
    John
    0

    Absolutely. The only thing I've changed is adding .AddAzureBlobMediaFileSystem() and .AddAzureBlobImageSharpCache() per the instructions I found here.

    To be clear, I'm running v12.3

    namespace RedWingMusicRepair
    

    { public class Startup { private readonly IWebHostEnvironment _env; private readonly IConfiguration _config;

        /// <summary>
        /// Initializes a new instance of the <see cref="Startup" /> class.
        /// </summary>
        /// <param name="webHostEnvironment">The web hosting environment.</param>
        /// <param name="config">The configuration.</param>
        /// <remarks>
        /// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337.
        /// </remarks>
        public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
        {
            _env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
            _config = config ?? throw new ArgumentNullException(nameof(config));
        }
    
        /// <summary>
        /// Configures the services.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <remarks>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940.
        /// </remarks>
        public void ConfigureServices(IServiceCollection services)
        { 
            services.AddUmbraco(_env, _config) 
                .AddBackOffice() 
                .AddWebsite()
                .AddDeliveryApi() 
                .AddComposers()
                .AddAzureBlobMediaFileSystem() // This configures the required services for Media
                .AddAzureBlobImageSharpCache() // This configures the required services for the Image Sharp cache
                .Build();
        }
    
        /// <summary> 
        /// Configures the application.
        /// </summary>
        /// <param name="app">The application builder.</param>
        /// <param name="env">The web hosting environment.</param>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
    
            app.UseUmbraco()
                .WithMiddleware(u =>  
                {
                    u.UseBackOffice();
                    u.UseWebsite();
                })
                .WithEndpoints(u =>
                {
                    u.UseInstallerEndpoints();
                    u.UseBackOfficeEndpoints();
                    u.UseWebsiteEndpoints();
                });
        }
    }
    

    }

    Thanks for responding, Stuart.

  • bh 444 posts 1544 karma points
    Nov 03, 2023 @ 14:02
    bh
    0

    @john looks like you beat me to it. I'm seeing same errors on clean installs of 12.2 and 12.3 and I'm not using Azure Blob storage.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Nov 03, 2023 @ 14:41
    Huw Reddick
    0

    Can't see anything wrong with your startup, blob storage is working for me in 12.3

  • Stuart Paterson 58 posts 229 karma points
    Nov 03, 2023 @ 14:46
    Stuart Paterson
    0

    Same here, Startup.cs looks fine, but for what it's worth I am seeing quite a lot of other forum posts relating to that error code you're seeing on build.

    Exited with error code -2146232797

    I'm sure you've probably found these posts as well John but those posts hint at it being more of a local environment or VS issue? People talking about a clean and rebuild then closing and re-opening the project or local storage low etc but don't want to have you on a wild goose chase :)

  • John 7 posts 108 karma points
    Nov 03, 2023 @ 14:52
    John
    0

    Yeah, that's about where I'm at. Even removing the references to both of those methods in AddUmbraco(), and ditching the connection string info, I get that error. Blowing it away and installing fresh seems to be my only option.

    Related newbie question: should the Azure blob storage connection string information go in the appsettings.json or the appsettings.Development.json file?

  • Stuart Paterson 58 posts 229 karma points
    Nov 03, 2023 @ 15:00
    Stuart Paterson
    0

    I've actually got the blob storage connection in both AppSettings.json and an AppSettings.Production.Json which I don't think will do any harm.

    From my understanding anything different which you put within the other AppSettings.Development.json file just overrides what's in the base AppSettings.json file if the same key exists.

    Sorry couldn't be more help on the original question, but if I stumble across anything I'll be sure and post it.

  • John 7 posts 108 karma points
    Nov 03, 2023 @ 15:03
    John
    0

    No worries, @stuartpaterson. I sincerely appreciate the help! I'll be sure to post if I figure out what's going sideways for me.

  • bh 444 posts 1544 karma points
    Nov 03, 2023 @ 14:54
    bh
    0

    @stuartpaterson i did a clean install of 12.3. Built the project. Cleaned. Rebuilt. Closed the Project. Reopened the Project. Still the same result when I try to debug. Thanks for the stuff to try though!

  • John 7 posts 108 karma points
    Dec 22, 2023 @ 13:51
    John
    100

    UPDATE: After installing 13.0.3, the errors went away.

    That's great, but when I try to add a media object (image), I get The specified container does not exist

    I pulled the ConnectionString value from the blob storage account's Access Keys and the ContainerName is just the name of the blog storage object itself.

    I'm not sure what I'm missing here.

    RESOLVED: This has been resolved in 13.3 apparently. After the update (and pinning down the actual name of the container), I managed to get this working. Score one for the newbie I guess.

Please Sign in or register to post replies

Write your reply to:

Draft