如果我像这样快速连续安装 IIS 服务器和托管包(在新的 Windows 10 服务器上):
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools
# Ignore the next line for now, its my current workaround
Start-Sleep -Seconds 120
Write-Host "-- Installing Dotnet Hosting Bundle"
$ErrorActionPreference = "Stop";
$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;
$Web = New-Object Net.Web;
$Uri = 'https://download.visualstudio.microsoft.com/download/pr/0d000d1b-89a4-4593-9708-eb5177777c64/cfb3d74447ac78defb1b66fd9b3f38e0/dotnet-hosting-6.0.6-win.exe';
if ($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))) { $Web.Proxy = New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True); };
$Web.DownloadFile($Uri, $downloadPath);
$arguments = New-Object -TypeName System.Collections.Generic.List[System.String]
$arguments.Add("/quiet")
$arguments.Add("/norestart")
Start-Process -FilePath $downloadPath -ArgumentList $arguments -NoNewWindow -Wait -PassThru -WorkingDirectory $tempDir
Write-Host "-- Restarting IIS"
Stop-Service W3SVC
Start-Service W3SVC
Get-Service W3SVC
从安装的角度来看,一切都很好。但是,如果我在 IIS 中运行.NET Core 应用程序,则会发生以下错误:
HTTP Error 500.19-HRESULT code 0x8007000d现在的问题是:
我如何完全避免这种情况?
或我如何等到 IIS 真的安装,所以它是安全的安装托管包?
如果在 IIS 之前安装了 Hosting Bundle,则必须修复安装。安装 IIS 后,请再次运行 Hosting Bundle 安装程序。
这是我在另一个网站找到的方法:
在安装“.NET Core IIS Hosting”先决条件之前,使用启用 IIS 的自定义操作。
例如,您可以将自定义操作添加为非顺序自定义操作(以便可以从 UI 控件触发),然后在“对话框”页面中安排它--& gt;“预安装 UI”--& gt;“WelcomePrereqDlg”对话框--& gt;“下一步”按钮。这将在安装先决条件之前启用 IIS。
该方法来自此链接:https://www.advancedinstaller.com/forums/viewtopic.php?t=44696
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(18条)