diff --git a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj index 4ab4e7bb74..d94d2ccc87 100644 --- a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj +++ b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj index 15fae55d3d..20c0925180 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj @@ -6,8 +6,6 @@ - - diff --git a/src/Umbraco.Web.UI.New/Program.cs b/src/Umbraco.Web.UI.New/Program.cs index cebb7b0370..ce23e48ff6 100644 --- a/src/Umbraco.Web.UI.New/Program.cs +++ b/src/Umbraco.Web.UI.New/Program.cs @@ -1,19 +1,31 @@ -namespace Umbraco.Cms.Web.UI -{ - public class Program - { - public static void Main(string[] args) - => CreateHostBuilder(args) - .Build() - .Run(); +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureUmbracoDefaults() - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStaticWebAssets(); - webBuilder.UseStartup(); - }); - } -} +builder.CreateUmbracoBuilder() + .AddBackOffice() + .AddWebsite() + .AddDeliveryApi() + .AddComposers() + .Build(); + +WebApplication app = builder.Build(); + +await app.BootUmbracoAsync(); + +#if (UseHttpsRedirect) +app.UseHttpsRedirection(); +#endif + +app.UseUmbraco() + .WithMiddleware(u => + { + u.UseBackOffice(); + u.UseWebsite(); + }) + .WithEndpoints(u => + { + u.UseInstallerEndpoints(); + u.UseBackOfficeEndpoints(); + u.UseWebsiteEndpoints(); + }); + +await app.RunAsync(); diff --git a/src/Umbraco.Web.UI.New/Startup.cs b/src/Umbraco.Web.UI.New/Startup.cs deleted file mode 100644 index 06ca2f0cf1..0000000000 --- a/src/Umbraco.Web.UI.New/Startup.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Umbraco.Cms.Core.DependencyInjection; -using Umbraco.Extensions; - -namespace Umbraco.Cms.Web.UI -{ - public class Startup - { - private readonly IWebHostEnvironment _env; - private readonly IConfiguration _config; - - /// - /// Initializes a new instance of the class. - /// - /// The web hosting environment. - /// The configuration. - /// - /// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337. - /// - public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config) - { - _env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); - _config = config ?? throw new ArgumentNullException(nameof(config)); - } - - /// - /// Configures the services. - /// - /// The services. - /// - /// 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. - /// - public void ConfigureServices(IServiceCollection services) - { - services.AddUmbraco(_env, _config) - .AddBackOffice() - .AddWebsite() - .AddDeliveryApi() - .AddComposers() - .Build(); - } - - /// - /// Configures the application. - /// - /// The application builder. - /// The web hosting environment. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - - Console.WriteLine(@"Enabling CORS in development mode"); - app.UseCors(u => - { - u.AllowCredentials(); - u.AllowAnyMethod(); - u.AllowAnyHeader(); - u.WithExposedHeaders("Location"); - u.WithOrigins(new[] { "http://127.0.0.1:5173", "http://localhost:5173", "https://127.0.0.1:5173", "https://localhost:5173" }); - }); - } -#if (UseHttpsRedirect) - - app.UseHttpsRedirection(); -#endif - - app.UseUmbraco() - .WithMiddleware(u => - { - u.UseBackOffice(); - u.UseWebsite(); - }) - .WithEndpoints(u => - { - u.UseInstallerEndpoints(); - u.UseBackOfficeEndpoints(); - u.UseWebsiteEndpoints(); - }); - } - } -} diff --git a/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj b/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj index 7a09062998..776fd5d2a9 100644 --- a/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj +++ b/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj @@ -11,7 +11,7 @@ - + all diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 3fc706b3cd..12ce23f678 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -28,7 +28,6 @@ - all diff --git a/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs b/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs index 4e4749860c..8b6a02a1d9 100644 --- a/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs +++ b/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs @@ -139,7 +139,7 @@ public class UmbracoRouteValueTransformer : DynamicRouteValueTransformer HttpContext httpContext, RouteValueDictionary values) { // If we aren't running, then we have nothing to route. We allow the frontend to continue while in upgrade mode. - if (_runtime.Level != RuntimeLevel.Run && _runtime.Level != RuntimeLevel.Upgrade) + if (_runtime.Level != RuntimeLevel.Run && _runtime.Level != RuntimeLevel.Upgrade && !httpContext.Request.IsClientSideRequest()) { if (_runtime.Level == RuntimeLevel.Install) {