[英]How do you install .Net Core Hosting Bundle via Azure Pipelines?
I've setup a deployment group successfully via Azure Pipelines and have deployed my Api successfully as well.我已经通过 Azure Pipelines 成功设置了一个部署组,并且也成功部署了我的 Api。 My homework says that I have to prove that the Api was deployed successfully so I thought that I should run this via IIS.
我的作业说我必须证明 Api 部署成功,所以我认为我应该通过 IIS 运行它。 However, a 502.5 error is being thrown and I find out that a server hosting bundle is needed.
但是,抛出了 502.5 错误,我发现需要服务器托管包。 How do you automate this via Azure PIpelines?
您如何通过 Azure PIpelines 自动执行此操作? I found an Invoke-Webrequest script that does this but it only installs 1.0.0...
我找到了一个执行此操作的 Invoke-Webrequest 脚本,但它只安装 1.0.0 ...
I'm not sure if there is a built in way to do this, but in our project we've done it by including the DotNetCore.2.0.7-WindowsHosting.exe
installer in our build artifacts and simply executing the installer with a Powershell step at the beginning of the release process.我不确定是否有内置的方法来做到这一点,但在我们的项目中,我们通过在我们的构建工件中包含
DotNetCore.2.0.7-WindowsHosting.exe
安装程序并简单地使用 Powershell 执行安装程序来完成它发布过程开始时的步骤。
You'll want to use the /quiet
and /norestart
flags:您需要使用
/quiet
和/norestart
标志:
$Path = "path to your installer exe in artifacts"
$args = New-Object -TypeName System.Collections.Generic.List[System.String]
$args.Add("/quiet")
$args.Add("/norestart")
Start-Process -FilePath $Path -ArgumentList $args -NoNewWindow -Wait -PassThru
Good luck!祝你好运!
if you are looking to download this directly from MS instead you can use this script:如果你想直接从 MS 下载它,你可以使用这个脚本:
$ErrorActionPreference="Stop";
If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] “Administrator”)){
throw "Run command in Administrator PowerShell Prompt"
};If($PSVersionTable.PSVersion -lt (New-Object System.Version("3.0"))){ throw "The minimum version of Windows PowerShell that is required by the script (3.0) does not match the currently running version of Windows PowerShell." };
$tempDir = [System.IO.Path]::GetTempPath()
$downloadPath="$tempdir\netCoreHostingBundle.exe";
$DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy;
$securityProtocol=@();
$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol;
$securityProtocol+=[Net.SecurityProtocolType]::Tls12;
[Net.ServicePointManager]::SecurityProtocol=$securityProtocol;
$WebClient=New-Object Net.WebClient;
$Uri='https://download.visualstudio.microsoft.com/download/pr/9b9f4a6e-aef8-41e0-90db-bae1b0cf4e34/4ab93354cdff8991d91a9f40d022d450/dotnet-hosting-3.1.6-win.exe';
if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))){$WebClient.Proxy= New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True);};
$WebClient.DownloadFile($Uri, $downloadPath);
$args = New-Object -TypeName System.Collections.Generic.List[System.String]
$args.Add("/quiet")
$args.Add("/norestart")
Start-Process -FilePath $downloadPath -ArgumentList $args -NoNewWindow -Wait -PassThru -WorkingDirectory $tempDir
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.