protected override IEnumerable <Action <XElement, string> > GetWebConfigActions() { if (IISDeploymentParameters.PublishApplicationBeforeDeployment) { // For published apps, prefer the content in the web.config, but update it. yield return(WebConfigHelpers.AddOrModifyAspNetCoreSection( key: "hostingModel", value: DeploymentParameters.HostingModel.ToString())); yield return(WebConfigHelpers.AddOrModifyHandlerSection( key: "modules", value: AspNetCoreModuleV2ModuleName)); // We assume the x64 dotnet.exe is on the path so we need to provide an absolute path for x86 scenarios. // Only do it for scenarios that rely on dotnet.exe (Core, portable, etc.). if (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.CoreClr && DeploymentParameters.ApplicationType == ApplicationType.Portable && DotNetCommands.IsRunningX86OnX64(DeploymentParameters.RuntimeArchitecture)) { var executableName = DotNetCommands.GetDotNetExecutable(DeploymentParameters.RuntimeArchitecture); if (!File.Exists(executableName)) { throw new Exception($"Unable to find '{executableName}'.'"); } yield return(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", executableName)); } } foreach (var action in base.GetWebConfigActions()) { yield return(action); } }
protected override IEnumerable <Action <XElement, string> > GetWebConfigActions() { yield return(WebConfigHelpers.AddOrModifyAspNetCoreSection( key: "hostingModel", value: DeploymentParameters.HostingModel.ToString())); yield return((element, _) => { var aspNetCore = element .Descendants("system.webServer") .Single() .GetOrAdd("aspNetCore"); // Expand path to dotnet because IIS process would not inherit PATH variable if (aspNetCore.Attribute("processPath")?.Value.StartsWith("dotnet", StringComparison.Ordinal) == true) { aspNetCore.SetAttributeValue("processPath", DotNetCommands.GetDotNetExecutable(DeploymentParameters.RuntimeArchitecture)); } }); yield return(WebConfigHelpers.AddOrModifyHandlerSection( key: "modules", value: AspNetCoreModuleV2ModuleName)); foreach (var action in base.GetWebConfigActions()) { yield return(action); } }