From 0aae5c1df1d782d604906a9f9ec285c82161d33d Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Fri, 15 Feb 2019 16:41:50 +1100 Subject: [PATCH] Lifting up where the hosted test is --- src/Umbraco.Web/Runtime/WebRuntimeComponent.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index a7de6ca842..2e3e048282 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -73,8 +73,12 @@ namespace Umbraco.Web.Runtime // setup mvc and webapi services SetupMvcAndWebApi(); - // client dependency - ConfigureClientDependency(_globalSettings); + // When using a non-web runtime and this component is loaded ClientDependency explodes because it'll + // want to access HttpContext.Current, which doesn't exist + if (IOHelper.IsHosted) + { + ConfigureClientDependency(_globalSettings); + } // Disable the X-AspNetMvc-Version HTTP Header MvcHandler.DisableMvcResponseHeader = true; @@ -278,10 +282,7 @@ namespace Umbraco.Web.Runtime { "compositeFileHandlerPath", ClientDependencySettings.Instance.CompositeFileHandlerPath } }); - // When using a non-web runtime and this component is loaded ClientDependency explodes because it'll - // want to access HttpContext.Current, which doesn't exist - if (IOHelper.IsHosted) - ClientDependencySettings.Instance.MvcRendererCollection.Add(renderer); + ClientDependencySettings.Instance.MvcRendererCollection.Add(renderer); } } }