Running Umbraco v10 in .NET 6' minimal hosting model
Is it possible to run Umbraco v10 in .NET 6' minimal hosting model? By this I mean the new way of bootstrapping .NET 6 applications with just a Program.cs file instead of a Program.cs and Startup.cs, as it was for .NET 5.
I've come this far, but keep running into errors related to ambiguous controller registrations:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddUmbraco(builder.Environment, builder.Configuration)
.AddBackOffice()
.AddWebsite()
.AddComposers()
.Build();
builder.Services.AddRazorPages();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseUmbraco()
.WithMiddleware(u =>
{
u.UseBackOffice();
u.UseWebsite();
})
.WithEndpoints(u =>
{
u.UseInstallerEndpoints();
u.UseBackOfficeEndpoints();
u.UseWebsiteEndpoints();
});
app.UseUmbracoRouting();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
//await app.InitializeApplicationAsync();
app.Run();
I keep getting this error on app.Run():
System.ArgumentNullException: 'Value cannot be null. (Parameter 'provider')'
Running Umbraco v10 in .NET 6' minimal hosting model
Is it possible to run Umbraco v10 in .NET 6' minimal hosting model? By this I mean the new way of bootstrapping .NET 6 applications with just a Program.cs file instead of a Program.cs and Startup.cs, as it was for .NET 5.
I've come this far, but keep running into errors related to ambiguous controller registrations:
I keep getting this error on
app.Run()
:System.ArgumentNullException: 'Value cannot be null. (Parameter 'provider')'
What am I missing here? Thanks in advance!
Raymond
I tried and failed. I created a startup file like in core 5.0
startup.cs
Minimal hosting model may or may not be supported yet, someone seems to have made it work in the comments here: https://github.com/umbraco/Umbraco-CMS/issues/12445#issuecomment-1227264825
Thanks Sebastiaan. Even though that work-around does run Umbraco 10, it doesn't play nice with the
AppModule
paradigm used by ABP.io.I'd be interested to see if both can be combined into one project.
is working on a reply...