无法使用chocolatey安装ASP.NET MVC 3

问题描述 投票:0回答:1

过去,我使用以下命令在 dockerfile 中使用 Chocolaty 安装 MVC 3,没有出现任何问题。由于某种原因,我开始收到 404 not found 消息。我认为该包本身包含不正确的 exe 路径。假设该软件包不再维护,我该如何安装 MVC 3?根据记录,我尝试使用 PowerShell 和 CURL 安装 exe,但都没有成功。非常感谢任何帮助。

Choco 网站,带有命令https://community.chocolatey.org/packages/aspnetmvc.install

最小 DockerFile:

# escape=`
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2022
SHELL ["cmd", "/S", "/C"]

# Install Chocolatey
RUN Echo "*********** Chocolatey Install"
RUN powershell.exe Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install MVC
RUN Echo "*********** Install MVC"
RUN choco install aspnetmvc --yes

错误

RUN choco install aspnetmvc --yes
 ---> Running in 59edd75191b8
Chocolatey v2.2.2
Installing the following packages:
aspnetmvc
By installing, you accept licenses for the packages.

Progress: Downloading aspnetmvc.install 3.1.0.20140613... 19%
Progress: Downloading aspnetmvc.install 3.1.0.20140613... 53%
Progress: Downloading aspnetmvc.install 3.1.0.20140613... 86%
Progress: Downloading aspnetmvc.install 3.1.0.20140613... 100%

aspnetmvc.install v3.1.0.20140613 [Approved]
aspnetmvc.install package files install completed. Performing other installation steps.
This will take forever to install. Go outside or something...come back in about an hour or so. For serious yo...
Attempt to get headers for http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=82cbd599-d29a-43e3-b78b-0f863d22811a&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fF%2f3%2f1%2fF31EF055-3C46-4E35-AB7B-3261A303A3B6%2fAspNetMVC3ToolsUpdateSetup.exe failed.
  The remote file either doesn't exist, is unauthorized, or is forbidden for url 'http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=82cbd599-d29a-43e3-b78b-0f863d22811a&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fF%2f3%2f1%2fF31EF055-3C46-4E35-AB7B-3261A303A3B6%2fAspNetMVC3ToolsUpdateSetup.exe'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (404) Not Found."
Downloading aspnetmvc 
  from 'http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=82cbd599-d29a-43e3-b78b-0f863d22811a&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fF%2f3%2f1%2fF31EF055-3C46-4E35-AB7B-3261A303A3B6%2fAspNetMVC3ToolsUpdateSetup.exe'
ERROR: The remote file either doesn't exist, is unauthorized, or is forbidden for url 'http://www.microsoft.com/downloads/info.aspx?na=41&srcfamilyid=82cbd599-d29a-43e3-b78b-0f863d22811a&srcdisplaylang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fF%2f3%2f1%2fF31EF055-3C46-4E35-AB7B-3261A303A3B6%2fAspNetMVC3ToolsUpdateSetup.exe'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (404) Not Found."
The install of aspnetmvc.install was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\aspnetmvc.install\tools\chocolateyInstall.ps1'.
 See log for details.

Progress: Downloading aspnetmvc 3.0.0.2... 23%
Progress: Downloading aspnetmvc 3.0.0.2... 62%
Progress: Downloading aspnetmvc 3.0.0.2... 100%

aspnetmvc v3.0.0.2 [Approved]
aspnetmvc package files install completed. Performing other installation steps.
 The install of aspnetmvc was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\aspnetmvc'

Chocolatey installed 1/2 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - aspnetmvc.install (exited 404) - Error while running 'C:\ProgramData\chocolatey\lib\aspnetmvc.install\tools\chocolateyInstall.ps1'.
 See log for details.
The command 'cmd /S /C choco install aspnetmvc --yes' returned a non-zero code: 404
Process exited with code 404
docker asp.net-mvc-3 dockerfile chocolatey choco
1个回答
0
投票

自从几年前上次推送软件包以来,微软已经移动了远程文件。

该文件似乎仍然存在 here,尽管 Microsoft 确实经常更改此类内容(就上下文而言,该包上次更新于 2014 年)。

您可以使用该 URL 创建软件包的版本,并从本地存储库使用它,创建包含 EXE 的软件包版本,或者在 Dockerfile 中复制安装逻辑。

也就是说,存储库上现在有该包的更新版本。您可以通过调用

choco install aspnetmvc.install --version=3.1.0.20231130
指定安装它,或者等待它被批准,此时它将按照您当前使用的方式安装。

请注意,

aspnetmvc
包装上写着:

ASP.NET MVC - 此软件包已被弃用,取而代之的是 aspnetmvc.install

您可以将 dockerfile 修改为以下内容:

RUN choco install aspnetmvc.install --yes

© www.soinside.com 2019 - 2024. All rights reserved.