diff --git a/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs b/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs index f0d0427438..cff5a589f6 100644 --- a/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs +++ b/src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs @@ -61,8 +61,9 @@ public class UmbracoVirtualPageRoute : IUmbracoVirtualPageRoute if (controllerType != null) { - // Get the controller for the endpoint - var controller = httpContext.RequestServices.GetRequiredService(controllerType); + // Get the controller for the endpoint. We need to fallback to ActivatorUtilities if the controller is not registered in DI. + var controller = httpContext.RequestServices.GetService(controllerType) + ?? ActivatorUtilities.CreateInstance(httpContext.RequestServices, controllerType); // Try and find the content if this is a virtual page IPublishedContent? publishedContent = FindContent(