首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在不遇到错误的情况下快速地安装IIS服务器和托管包?

问如何在不遇到错误的情况下快速地安装IIS服务器和托管包?
EN

Stack Overflow用户
提问于 2022-08-09 16:09:42
回答 1查看 809关注 0票数 0

如果我像这样快速地安装IIS服务器并托管包(在新的Windows 10服务器上):

代码语言:javascript
复制
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;
$WebClient = New-Object Net.WebClient; 

$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))) { $WebClient.Proxy = New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True); };
$WebClient.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应用程序,则会发生以下错误:

HTTP错误500.19 - HRESULT代码0x8007000d

在当“在IIS之前安装宿主绑定”时会发生这种情况。下面一句写了一个简单的解决方案:“必须修复捆绑安装”。上搜索,这确实有效。

现在的问题是:

  • 我怎样才能完全避免这种情况呢?
  • 或者,如何等到IIS真正安装,这样才能安全地安装托管包?
EN

回答 1

Stack Overflow用户

发布于 2022-08-10 06:42:25

如果宿主绑定是在IIS之前安装的,则必须修复包安装。安装IIS后,再次运行宿主捆绑安装程序。

这是我在另一个站点找到的方法:

使用自定义操作,在安装".NET核心IIS托管“先决条件之前启用IIS。

例如,您可以将自定义操作添加为非顺序的自定义操作(因此它可以从UI控件中触发),然后在"Dialogs“页面->”预装UI“-> "WelcomePrereqDlg”对话框-> "Next“按钮中调度它。这将在安装先决条件之前启用IIS。

该方法来自以下链接:https://www.advancedinstaller.com/forums/viewtopic.php?t=44696

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73294949

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档