From 32110540633bd5485ecdec98e7b68ec1ae2affa2 Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Sat, 26 Oct 2019 13:02:19 +0100 Subject: [PATCH] look for the system.web section under the root configuration node use Element to get the root system.web. DescendantsAndSelf can return multiple --- src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs index 4d64d30e9d..c273d642ed 100644 --- a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs +++ b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs @@ -39,7 +39,8 @@ namespace Umbraco.Web.Install.InstallSteps var fileName = IOHelper.MapPath($"{SystemDirectories.Root}/web.config"); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); - var systemWeb = xml.Root.DescendantsAndSelf("system.web").Single(); + // we only want to get the element that is under the root, (there may be more under tags we don't want them) + var systemWeb = xml.Root.Element("system.web"); // Update appSetting if it exists, or else create a new appSetting for the given key and value var machineKey = systemWeb.Descendants("machineKey").FirstOrDefault();