Search code examples
dockerasp.net-mvc-3dockerfilechocolateychoco

Unable to install ASP.NET MVC 3 using chocolatey


In the past, I have used the following command to install MVC 3 using chocolaty in the dockerfile without issue. For some reason, I started getting the 404 not found message. I think the package itself contains an improper exe path. Assuming the package is no longer maintained, how can I install MVC 3? For the record, I have tried installing the exe using PowerShell and CURL, but none of them have been successful. Any help is greatly appreciated.

Choco website with command: https://community.chocolatey.org/packages/aspnetmvc.install

Minimal 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

Error:

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

Solution

  • Microsoft have moved the remote file since the package was last pushed, some years ago.

    The file does still seem to be present here, though Microsoft do change this sort of thing every so often (for context, the package was last updated in 2014).

    You can create a version of the package with that URL instead and use it from a local repository, create a version of the package with the EXE included inside, or replicate the installation logic in your Dockerfile.

    That said, there's now an updated version of the package on the repository. You can specify installing it by calling choco install aspnetmvc.install --version=3.1.0.20231130, or wait for it to be approved at which point it will be installed in the way you are currently using.

    As a note, the aspnetmvc package says this:

    ASP.NET MVC - This package has been deprecated in favor of aspnetmvc.install

    You could modify your dockerfile to the following:

    RUN choco install aspnetmvc.install --confirm