Copied to clipboard

Flag this post as spam?

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


  • John Benes 3 posts 93 karma points
    Nov 20, 2023 @ 15:31
    John Benes
    0

    How to use services.AddUmbraco

    I'm new to Umbraco and am trying to write my first Umbraco .Net 7 app (I already know .Net). Is there any documentation on the various .Add* (i.e. .AddBackOffice) methods and their dependencies?

    I want the minimum number of components to get and cache published objects. I'm trying to use UmbracoHelper to get the content but when the app runs I get the error " Could not check the upgrade state" , and "The specified invariant name 'Microsoft.Data.SqlClient' wasn't found in the list of registered .NET Data Providers."

    The code: public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddEndpointsApiExplorer(); services.AddSwaggerGen();

            services.AddUmbraco(_env, _config)
                .AddBackOffice()
                .Build();
        }
    

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(); }

            app.UseHttpsRedirection();
    
            app.UseAuthorization();
    
            app.UseUmbraco()
                .WithMiddleware(u =>
                {
                    u.UseBackOffice();
                });
                    };
    

    Appsettings

    "ConnectionStrings": { "umbracoDbDSN": "server=xxx;Database=UmbracoCms;TrustedConnection=True;TrustServerCertificate=True", "umbracoDbDSNProviderName": "Microsoft.Data.SqlClient", }

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies