public override async Task <DeploymentResult> DeployAsync() { using (Logger.BeginScope("Deployment")) { StartTimer(); var contentRoot = string.Empty; if (string.IsNullOrEmpty(DeploymentParameters.ServerConfigTemplateContent)) { DeploymentParameters.ServerConfigTemplateContent = File.ReadAllText("IIS.config"); } _application = new IISApplication(IISDeploymentParameters, Logger); // For now, only support using published output DeploymentParameters.PublishApplicationBeforeDeployment = true; if (DeploymentParameters.ApplicationType == ApplicationType.Portable) { DefaultWebConfigActions.Add( WebConfigHelpers.AddOrModifyAspNetCoreSection( "processPath", DotNetCommands.GetDotNetExecutable(DeploymentParameters.RuntimeArchitecture))); } if (DeploymentParameters.PublishApplicationBeforeDeployment) { DotnetPublish(); contentRoot = DeploymentParameters.PublishedApplicationRootPath; // Do not override settings set on parameters if (!IISDeploymentParameters.HandlerSettings.ContainsKey("debugLevel") && !IISDeploymentParameters.HandlerSettings.ContainsKey("debugFile")) { var logFile = Path.Combine(contentRoot, $"{_application.WebSiteName}.txt"); IISDeploymentParameters.HandlerSettings["debugLevel"] = "4"; IISDeploymentParameters.HandlerSettings["debugFile"] = logFile; } DefaultWebConfigActions.Add(WebConfigHelpers.AddOrModifyHandlerSection( key: "modules", value: DeploymentParameters.AncmVersion.ToString())); RunWebConfigActions(contentRoot); } var uri = TestUriHelper.BuildTestUri(ServerType.IIS, DeploymentParameters.ApplicationBaseUriHint); // To prevent modifying the IIS setup concurrently. await _application.StartIIS(uri, contentRoot); // Warm up time for IIS setup. Logger.LogInformation("Successfully finished IIS application directory setup."); return(new IISDeploymentResult( LoggerFactory, IISDeploymentParameters, applicationBaseUri: uri.ToString(), contentRoot: contentRoot, hostShutdownToken: _hostShutdownToken.Token, hostProcess: _application.HostProcess )); } }
public override async Task <DeploymentResult> DeployAsync() { using (Logger.BeginScope("Deployment")) { StartTimer(); var contentRoot = string.Empty; if (string.IsNullOrEmpty(DeploymentParameters.ServerConfigTemplateContent)) { DeploymentParameters.ServerConfigTemplateContent = File.ReadAllText("IIS.config"); } _application = new IISApplication(DeploymentParameters, Logger); // For now, only support using published output DeploymentParameters.PublishApplicationBeforeDeployment = true; if (DeploymentParameters.PublishApplicationBeforeDeployment) { DotnetPublish(); contentRoot = DeploymentParameters.PublishedApplicationRootPath; } WebConfigHelpers.AddDebugLogToWebConfig(contentRoot, Path.Combine(contentRoot, $"{_application.WebSiteName}.txt")); var uri = TestUriHelper.BuildTestUri(ServerType.IIS, DeploymentParameters.ApplicationBaseUriHint); // To prevent modifying the IIS setup concurrently. await _application.StartIIS(uri, contentRoot); // Warm up time for IIS setup. Logger.LogInformation("Successfully finished IIS application directory setup."); return(new DeploymentResult( LoggerFactory, DeploymentParameters, applicationBaseUri: uri.ToString(), contentRoot: contentRoot, hostShutdownToken: _hostShutdownToken.Token )); } }