本文介绍了如何将Artifactory配置为Chocolatey的缓存?安装软件包时得到404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Artifactory版本:6.16.2 rev 61602900, Artifactory Pro 许可证.

在Artifactory中,我添加了一个具有以下设置的REMOTE存储库:

  • 包裹类型: NuGet
  • 存储库密钥:巧克力远程
  • URL:

    在主机上,我已经配置了Chocolatey来源:

      choco source add --name = artifactory --source = https://< ARTIFACTORY>/api/nuget/chocolatey-remote --user = *** REDACTED ***---password = ***已删除***巧克力来源禁用--name Chocolatey巧克力来源清单 

    输出:

      PS C:\ Users \ vagrant>巧克力来源清单巧克力味v0.10.15人工制品-https://< ARTIFACTORY>/api/nuget/chocolatey-remote(已认证)|优先级0 |绕过代理服务器-错误|自助服务-错误|仅管理员-错误.Chocolatey [已禁用]-https://chocolatey.org/api/v2/|优先级0 |绕过代理服务器-错误|自助服务-错误|仅管理员-错误. 

    运行 choco info< PACKAGE> 时,我得到了预期的结果:

      PS C:\ Users \ vagrant>巧克力信息vlc巧克力味v0.10.15vlc 3.0.12标题:VLC媒体播放器|发行时间:1/18/2021下载次数:7848809 |此版本的下载:252349套件网址Chocolatey Package来源:n/a软件包校验和:'GNbCKwr6nqOoJc/DX/+ riBbXyncp1wV3xOAyYTaOgdls + SiKmvUXoIVXUBGTswQMPIc1tKSdYy + KvuVXb4jliQ =='(SHA512)标签:vlc foss跨平台多媒体音频视频mp3 DVD avi媒体播放器admin软件站点:http://www.videolan.org/vlc/软件许可:http://www.videolan.org/legal.html摘要:VLC媒体播放器描述:VLC是一个免费的开源跨平台多媒体播放器和框架,可播放大多数多媒体文件以及DVD,音频CD,VCD和各种流协议.(等等) 

    安装软件包时,我会收到404:

      PS C:\ Users \ vagrant>choco安装vlc巧克力味v0.10.15安装以下软件包:VLC通过安装,您接受软件包的许可证.vlc未安装.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到vlc软件包文件安装完成.执行其他安装步骤.vlc的安装未成功.vlc未安装.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到Chocolatey已安装0/1程序包.1个程序包失败.有关详细信息,请参阅日志(C:\ ProgramData \ chocolatey \ logs \ chocolatey.log).失败的-vlc(退出1)-未安装vlc.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到 

    这是 C:\ ProgramData \ chocolatey \ logs \ chocolatey.log :

      2021-02-04 09:42:36,839 764 [DEBUG]-XmlConfiguration现在可操作2021-02-04 09:42:36,870 764 [INFO]-============================================================2021-02-04 09:42:36,997 764 [INFO]-Chocolatey v0.10.152021-02-04 09:42:36,997 764 [DEBUG]-Chocolatey在Windows v 10.0.17763.0上运行2021-02-04 09:42:36,997 764 [DEBUG]-尝试删除文件"C:/ProgramData/chocolatey/choco.exe.old".2021-02-04 09:42:36,997 764 [DEBUG]-尝试删除文件"C:\ ProgramData \ chocolatey \ choco.exe.old".2021-02-04 09:42:37,010 764 [DEBUG]-命令行:"C:\ ProgramData \ chocolatey \ choco.exe"安装vlc2021-02-04 09:42:37,010 764 [DEBUG]-收到的参数:install vlc2021-02-04 09:42:37,041 764 [DEBUG]-RemovePendingPackagesTask现在已准备就绪,正在等待PreRunMessage.2021-02-04 09:42:37,041 764 [DEBUG]-如果有订阅者,则发送消息"PreRunMessage" ...2021-02-04 09:42:37,041 764 [DEBUG]-[Pending]删除所有不应被视为已安装的未决软件包...2021-02-04 09:42:37,088 764 [DEBUG]-执行验证检查.2021-02-04 09:42:37,088 764 [DEBUG]-全局配置验证检查:2021-02-04 09:42:37,088 764 [DEBUG]--程序包退出代码/重启后退出=已检查2021-02-04 09:42:37,088 764 [DEBUG]-系统状态验证检查:2021-02-04 09:42:37,088 764 [DEBUG]-重新启动要求检查:2021-02-04 09:42:37,088 764 [DEBUG]--待处理的计算机重命名=已选中2021-02-04 09:42:37,088 764 [DEBUG]--待处理的基于组件的服务=已选中2021-02-04 09:42:37,088 764 [DEBUG]--挂起的Windows自动更新=已选中2021-02-04 09:42:37,088 764 [DEBUG]--待处理文件重命名操作=已选中2021-02-04 09:42:37,088 764 [DEBUG]--待处理的Windows软件包安装程序=已选中2021-02-04 09:42:37,108 764 [DEBUG]--待处理的Windows软件包安装程序SysWow64 =已选中2021-02-04 09:42:37,108 764 [INFO]-执行了2次验证.2个成功,0个警告和0个错误.2021-02-04 09:42:37,108 764 [DEBUG]-源'https://< ARTIFACTORY>/api/nuget/chocolatey-remote'评估为正常"源类型2021-02-04 09:42:37,108 764 [DEBUG]-注意:隐藏敏感的配置数据!请加倍和三倍检查以确保没有显示敏感数据,尤其是在复制的情况下输出到要点进行审查.2021-02-04 09:42:37,119 764 [DEBUG]-配置:CommandName ='install'|CacheLocation ='C:\ Users \ vagrant \ AppData \ Local \ Temp \ chocolatey'|ContainsLegacyPackageInstalls ='True'|CommandExecutionTimeoutSeconds ='2700'| WebRequestTimeoutSeconds = '30'|来源='https://< ARTIFACTORY>/api/nuget/chocolatey-remote'|SourceType ='正常'| Debug ='False'|详细='False'| Trace ='False'|Force ='False'| Noop ='False'| HelpRequested ='False'|UnsuccessfulParsing ='False'| RegularOutput ='True'| QuietOutput ='False'|PromptForConfirmation ='True'| AcceptLicense ='False'|AllowUnofficialBuild ='False'| Input ='vlc'| AllVersions ='False'|SkipPackageInstallProvider ='False'| PackageNames ='vlc'|Prerelease ='False'| ForceX86 ='False'| OverrideArguments ='False'|NotSilent ='False'| ApplyPackageParametersToDependencies ='False'|ApplyInstallArgumentsToDependencies ='False'| IgnoreDependencies ='False'|AllowMultipleVersions ='False'| AllowDowngrade ='False'|ForceDependencies ='False'| Information.PlatformType ='Windows'|Information.PlatformVersion = '10 .0.17763.0'|Information.PlatformName ='Windows Server 2016'|Information.ChocolateyVersion ='0.10.15.0'|Information.ChocolateyProductVersion ='0.10.15'|Information.FullName ='choco,Version = 0.10.15.0,Culture = neutral,PublicKeyToken = 79d02ea9cad655eb'|Information.Is64BitOperatingSystem ='真'|Information.Is64BitProcess ='True'| Information.IsInteractive ='False'|Information.UserName ='无用'|Information.UserDomainName ='VAGRANT-I7ND05O'|Information.IsUserAdministrator ='True'|Information.IsUserSystemAccount ='False'|Information.IsUserRemoteDesktop ='False'|Information.IsUserRemote ='True'|Information.IsProcessElevated ='True'|Information.IsLicensedVersion ='False'| Information.LicenseType ='Foss'|Information.CurrentDirectory ='C:\ Users \ vagrant'|Features.AutoUninstaller ='True'| Features.ChecksumFiles ='True'|Features.AllowEmptyChecksums ='False'|功能.AllowEmptyChecksumsSecure='True'|Features.FailOnAutoUninstaller ='False'|Features.FailOnStandardError ='False'|功能.UsePowerShellHost ='True'|Features.LogEnvironmentValues ='False'| Features.LogWithoutColor ='False'|功能.VirusCheck ='False'|Features.FailOnInvalidOrMissingLicense ='False'|Features.IgnoreInvalidOptionsSwitches ='True'|Features.UsePackageExitCodes ='True'|Features.UseEnhancedExitCodes ='False'|Features.UseFipsCompliantChecksums ='False'|Features.ShowNonElevatedWarnings ='True'|Features.ShowDownloadProgress ='True'|Features.StopOnFirstPackageFailure ='False'|Features.UseRememberedArgumentsForUpgrades ='False'|Features.IgnoreUnfoundPackagesOnUpgradeOutdated ='False'|Features.SkipPackageUpgradesWhenNotInstalled ='False'|Features.RemovePackageInformationOnUninstall ='False'|Features.ExitOnRebootDetected ='False'|Features.LogValidationResultsOnWarnings ='True'|Features.UsePackageRepositoryOptimizations =真" |Features.ScriptsCheckLastExitCode ='False'|ListCommand.LocalOnly ='False'|ListCommand.IdOnly ='False'| ListCommand.IncludeRegistryPrograms ='False'|ListCommand.PageSize = '25'| ListCommand.Exact ='False'|ListCommand.ByIdOnly ='False'| ListCommand.ByTagOnly ='False'|ListCommand.IdStartsWith ='False'| ListCommand.OrderByPopularity ='False'|ListCommand.ApprovedOnly ='False'|ListCommand.DownloadCacheAvailable ='False'|ListCommand.NotBroken ='False'|ListCommand.IncludeVersionOverrides ='假'|UpgradeCommand.FailOnUnfound ='False'|UpgradeCommand.FailOnNotInstalled ='False'|UpgradeCommand.NotifyOnlyAvailableUpgrades ='False'|UpgradeCommand.ExcludePrerelease ='False'|NewCommand.AutomaticPackage ='False'|NewCommand.UseOriginalTemplate ='False'| SourceCommand.Command ='未知'|SourceCommand.Priority ='0'| SourceCommand.BypassProxy ='False'|SourceCommand.AllowSelfService ='False'|SourceCommand.VisibleToAdminsOnly ='False'|FeatureCommand.Command ='未知'| ConfigCommand.Command ='未知'|ApiKeyCommand.Remove ='False'| PinCommand.Command ='未知'|OutdatedCommand.IgnorePinned ='False'| Proxy.BypassOnLocal ='True'|2021-02-04 09:42:37,119 764 [DEBUG]-_ Chocolatey:ChocolateyInstallCommand-正常运行模式_2021-02-04 09:42:37,119 764 [INFO]-安装以下软件包:2021-02-04 09:42:37,119 764 [INFO]-vlc2021-02-04 09:42:37,119 764 [INFO]-安装后,您接受软件包的许可证.2021-02-04 09:42:37,166 764 [DEBUG]-使用'https://< ARTIFACTORY>/api/nuget/chocolatey-remote'.2021-02-04 09:42:37,338 764 [DEBUG]--支持预发布吗?'真的'.2021-02-04 09:42:37,338 764 [DEBUG]--是否基于服务?'真的'.2021-02-04 09:42:37,544 764 [DEBUG]-在源'https://< ARTIFACTORY>/api/nuget/chocolatey-remote'上找到的软件包'vlc'2021-02-04 09:42:37,589 764 [INFO]-[NuGet]尝试解决依赖项"chocolatey-core.extension(= 1.3.3)".2021-02-04 09:42:37,666 764 [ERROR]-未安装vlc.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到2021-02-04 09:42:37,666 764 [INFO]-vlc软件包文件安装完成.执行其他安装步骤.2021-02-04 09:42:37,666 764 [DEBUG]-没有软件包信息,因为软件包为null.2021-02-04 09:42:37,682 764 [DEBUG]-没有要保存的软件包信息,因为软件包为null.2021-02-04 09:42:37,682 764 [DEBUG]-如果有订阅者,则发送消息"HandlePackageResultCompletedMessage" ...2021-02-04 09:42:37,682 764 [错误]-vlc的安装未成功.2021-02-04 09:42:37,682 764 [ERROR]-未安装vlc.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到2021-02-04 09:42:37,682 764 [警告]-Chocolatey已安装0/1程序包.1个程序包失败.有关详细信息,请参阅日志(C:\ ProgramData \ chocolatey \ logs \ chocolatey.log).2021-02-04 09:42:37,682 764 [INFO]-2021-02-04 09:42:37,697 764 [ERROR]-失败2021-02-04 09:42:37,697 764 [错误]--vlc(退出1)-未安装vlc.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到2021-02-04 09:42:37,697 764 [DEBUG]-如果有订阅者,则发送消息"PostRunMessage" ...2021-02-04 09:42:37,732 764 [DEBUG]-以1退出 

    我如何在没有404的情况下获得可口的Chocolatey人工工厂缓存?

    我已经下载了Artifactory日志,并为 choco 做了grep:

      $ grep choco * .logaccess.log:2021-02-04 15:31:38,164 [拒绝下载]客户端的Chocolatey-remote-cache:vlc.3.0.12.nupkg:不适用/91.180.197.91.artifactory.log:2021-02-04 10:57:28,154 [http-nio-8081-exec-992] [INFO](o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64)-更新存储库Chocolatey-Remoteartifactory.log:2021-02-04 14:36:56,347 [http-nio-8081-exec-1053] [INFO](o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64)-更新存储库Chocolatey-Remoterequest.log:20210204153137 | 124 | REQUEST | 91.180.197.91 |匿名| GET |/api/nuget/chocolatey-remote | HTTP/1.0 | 200 | 0request.log:20210204153137 | 4 | REQUEST | 91.180.197.91 |匿名| GET |/api/nuget/chocolatey-remote/$ metadata | HTTP/1.0 | 200 | 0request.log:20210204153138 | 128 | REQUEST | 91.180.197.91 |匿名| GET |/api/nuget/chocolatey-remote/Packages()| HTTP/1.0 | 200 | 0request.log:20210204153138 | 16 | REQUEST | 91.180.197.91 |匿名| GET |/api/nuget/chocolatey-remote/Download/vlc/3.0.12 | HTTP/1.0 | 404 | 0 

    该行 [DENIED DOWNLOAD] Chocolatey-remote-cache:vlc.3.0.12.nupkg 与该问题有关,但是我需要一名Artifactory专家来帮助我理解它的含义

    我在以下答案中完全像@yahavi一样运行了 choco 命令:

      PS C:\ Users \ vagrant>choco install vlc --source = https://< ARTIFACTORY>/api/nuget/chocolatey-remote --user = ***已删除*** --password = ***已删除***巧克力味v0.10.15安装以下软件包:VLC通过安装,您接受软件包的许可证.vlc未安装.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到vlc软件包文件安装完成.执行其他安装步骤.vlc的安装未成功.vlc未安装.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到Chocolatey已安装0/1程序包.1个程序包失败.有关详细信息,请参阅日志(C:\ ProgramData \ chocolatey \ logs \ chocolatey.log).失败的-vlc(退出1)-未安装vlc.安装期间发生错误:远程服务器返回错误:(404)找不到.未找到 

    作为一个健全性检查,我也做了 choco install vlc --source = https://chocolatey.org/api/v2/,并且工作正常.这排除了Chocolatey方面的任何问题,这绝对是Artifactory的问题.

    解决方案

    尝试将 NuGet v3 Feed URL 设置为默认值: https://api.nuget.org/v3/index.json.

    我们在测试.用法与您的用法不完全相同,因为我们在install命令中添加了连接详细信息:

      choco install vlc -s< jfrog-url>/api/nuget/chocolatey-remote -u< username>-p< password> 

    要获取更多信息,欢迎阅读我的博客: https://jfrog.com/blog/artifactory-作为软件包管理器的缓存机制/

    Artifactory version: 6.16.2 rev 61602900, Artifactory Pro license.

    In Artifactory, I have added a REMOTE repository, with the following settings:

    • Package Type: NuGet
    • Repository Key: chocolatey-remote
    • URL: https://chocolatey.org/
    • Test: Successfully connected to server
    • Repository Layout: nuget-default
    • Include Patterns: **/*
    • NuGet Download Context Path: api/v2/package
    • NuGet Feed Context Path: api/v2
    • NuGet v3 Feed URL: (empty)

    Screenshots:

    On the host, I have configured Chocolatey sources:

    choco source add --name=artifactory --source=https://<ARTIFACTORY>/api/nuget/chocolatey-remote --user=***REDACTED*** --password=***REDACTED***
    choco source disable --name chocolatey
    choco source list
    

    Output:

    PS C:\Users\vagrant> choco source list
    Chocolatey v0.10.15
    artifactory - https://<ARTIFACTORY>/api/nuget/chocolatey-remote (Authenticated)| Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
    chocolatey [Disabled] - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
    

    When running choco info <PACKAGE>, I get an expected result:

    PS C:\Users\vagrant> choco info vlc
    Chocolatey v0.10.15
    vlc 3.0.12
     Title: VLC media player | Published: 1/18/2021
     Number of Downloads: 7848809 | Downloads for this version: 252349
     Package url
     Chocolatey Package Source: n/a
     Package Checksum: 'GNbCKwr6nqOoJc/DX/+riBbXyncp1wV3xOAyYTaOgdls+SiKmvUXoIVXUBGTswQMPIc1tKSdYy+KvuVXb4jliQ==' (SHA512)
     Tags: vlc foss cross-platform multimedia audio video mp3 dvd avi media player admin
     Software Site: http://www.videolan.org/vlc/
     Software License: http://www.videolan.org/legal.html
     Summary: VLC Media Player
     Description: VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols.
    (etc)
    

    When I install packages, I get a 404:

    PS C:\Users\vagrant> choco install vlc
    Chocolatey v0.10.15
    Installing the following packages:
    vlc
    By installing you accept licenses for the packages.
    vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    vlc package files install completed. Performing other installation steps.
    The install of vlc was NOT successful.
    vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    
    Chocolatey installed 0/1 packages. 1 packages failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
    
    Failures
     - vlc (exited 1) - vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    

    This is C:\ProgramData\chocolatey\logs\chocolatey.log:

    2021-02-04 09:42:36,839 764 [DEBUG] - XmlConfiguration is now operational
    2021-02-04 09:42:36,870 764 [INFO ] - ============================================================
    2021-02-04 09:42:36,997 764 [INFO ] - Chocolatey v0.10.15
    2021-02-04 09:42:36,997 764 [DEBUG] - Chocolatey is running on Windows v 10.0.17763.0
    2021-02-04 09:42:36,997 764 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
    2021-02-04 09:42:36,997 764 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
    2021-02-04 09:42:37,010 764 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install vlc
    2021-02-04 09:42:37,010 764 [DEBUG] - Received arguments: install vlc
    2021-02-04 09:42:37,041 764 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
    2021-02-04 09:42:37,041 764 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
    2021-02-04 09:42:37,041 764 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
    2021-02-04 09:42:37,088 764 [DEBUG] - Performing validation checks.
    2021-02-04 09:42:37,088 764 [DEBUG] - Global Configuration Validation Checks:
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
    2021-02-04 09:42:37,088 764 [DEBUG] - System State Validation Checks:
    2021-02-04 09:42:37,088 764 [DEBUG] -  Reboot Requirement Checks:
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Computer Rename = Checked
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Component Based Servicing = Checked
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Windows Auto Update = Checked
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending File Rename Operations = Checked
    2021-02-04 09:42:37,088 764 [DEBUG] -  - Pending Windows Package Installer = Checked
    2021-02-04 09:42:37,108 764 [DEBUG] -  - Pending Windows Package Installer SysWow64 = Checked
    2021-02-04 09:42:37,108 764 [INFO ] - 2 validations performed. 2 success(es), 0 warning(s), and 0 error(s).
    2021-02-04 09:42:37,108 764 [DEBUG] - The source 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote' evaluated to a 'normal' source type
    2021-02-04 09:42:37,108 764 [DEBUG] -
    NOTE: Hiding sensitive configuration data! Please double and triple
     check to be sure no sensitive data is shown, especially if copying
     output to a gist for review.
    2021-02-04 09:42:37,119 764 [DEBUG] - Configuration: CommandName='install'|
    CacheLocation='C:\Users\vagrant\AppData\Local\Temp\chocolatey'|
    ContainsLegacyPackageInstalls='True'|
    CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
    Sources='https://<ARTIFACTORY>/api/nuget/chocolatey-remote'|
    SourceType='normal'|Debug='False'|Verbose='False'|Trace='False'|
    Force='False'|Noop='False'|HelpRequested='False'|
    UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
    PromptForConfirmation='True'|AcceptLicense='False'|
    AllowUnofficialBuild='False'|Input='vlc'|AllVersions='False'|
    SkipPackageInstallProvider='False'|PackageNames='vlc'|
    Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
    NotSilent='False'|ApplyPackageParametersToDependencies='False'|
    ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
    AllowMultipleVersions='False'|AllowDowngrade='False'|
    ForceDependencies='False'|Information.PlatformType='Windows'|
    Information.PlatformVersion='10.0.17763.0'|
    Information.PlatformName='Windows Server 2016'|
    Information.ChocolateyVersion='0.10.15.0'|
    Information.ChocolateyProductVersion='0.10.15'|
    Information.FullName='choco, Version=0.10.15.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|
    
    Information.Is64BitOperatingSystem='True'|
    Information.Is64BitProcess='True'|Information.IsInteractive='False'|
    Information.UserName='vagrant'|
    Information.UserDomainName='VAGRANT-I7ND05O'|
    Information.IsUserAdministrator='True'|
    Information.IsUserSystemAccount='False'|
    Information.IsUserRemoteDesktop='False'|
    Information.IsUserRemote='True'|
    Information.IsProcessElevated='True'|
    Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
    Information.CurrentDirectory='C:\Users\vagrant'|
    Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
    Features.AllowEmptyChecksums='False'|
    Features.AllowEmptyChecksumsSecure='True'|
    Features.FailOnAutoUninstaller='False'|
    Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
    Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
    Features.VirusCheck='False'|
    Features.FailOnInvalidOrMissingLicense='False'|
    Features.IgnoreInvalidOptionsSwitches='True'|
    Features.UsePackageExitCodes='True'|
    Features.UseEnhancedExitCodes='False'|
    Features.UseFipsCompliantChecksums='False'|
    Features.ShowNonElevatedWarnings='True'|
    Features.ShowDownloadProgress='True'|
    Features.StopOnFirstPackageFailure='False'|
    Features.UseRememberedArgumentsForUpgrades='False'|
    Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
    Features.SkipPackageUpgradesWhenNotInstalled='False'|
    Features.RemovePackageInformationOnUninstall='False'|
    Features.ExitOnRebootDetected='False'|
    Features.LogValidationResultsOnWarnings='True'|
    Features.UsePackageRepositoryOptimizations='True'|
    Features.ScriptsCheckLastExitCode='False'|
    ListCommand.LocalOnly='False'|
    ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
    ListCommand.PageSize='25'|ListCommand.Exact='False'|
    ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
    ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
    ListCommand.ApprovedOnly='False'|
    ListCommand.DownloadCacheAvailable='False'|
    ListCommand.NotBroken='False'|
    ListCommand.IncludeVersionOverrides='False'|
    UpgradeCommand.FailOnUnfound='False'|
    UpgradeCommand.FailOnNotInstalled='False'|
    UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
    UpgradeCommand.ExcludePrerelease='False'|
    NewCommand.AutomaticPackage='False'|
    NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
    SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
    SourceCommand.AllowSelfService='False'|
    SourceCommand.VisibleToAdminsOnly='False'|
    FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
    ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
    OutdatedCommand.IgnorePinned='False'|Proxy.BypassOnLocal='True'|
    2021-02-04 09:42:37,119 764 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
    2021-02-04 09:42:37,119 764 [INFO ] - Installing the following packages:
    2021-02-04 09:42:37,119 764 [INFO ] - vlc
    2021-02-04 09:42:37,119 764 [INFO ] - By installing you accept licenses for the packages.
    2021-02-04 09:42:37,166 764 [DEBUG] - Using 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote'.
    2021-02-04 09:42:37,338 764 [DEBUG] - - Supports prereleases? 'True'.
    2021-02-04 09:42:37,338 764 [DEBUG] - - Is ServiceBased? 'True'.
    2021-02-04 09:42:37,544 764 [DEBUG] - Package 'vlc' found on source 'https://<ARTIFACTORY>/api/nuget/chocolatey-remote'
    2021-02-04 09:42:37,589 764 [INFO ] - [NuGet] Attempting to resolve dependency 'chocolatey-core.extension (= 1.3.3)'.
    2021-02-04 09:42:37,666 764 [ERROR] - vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    2021-02-04 09:42:37,666 764 [INFO ] - vlc package files install completed. Performing other installation steps.
    2021-02-04 09:42:37,666 764 [DEBUG] - No package information as package is null.
    2021-02-04 09:42:37,682 764 [DEBUG] - No package information to save as package is null.
    2021-02-04 09:42:37,682 764 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
    2021-02-04 09:42:37,682 764 [ERROR] - The install of vlc was NOT successful.
    2021-02-04 09:42:37,682 764 [ERROR] - vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    2021-02-04 09:42:37,682 764 [WARN ] -
    Chocolatey installed 0/1 packages. 1 packages failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
    2021-02-04 09:42:37,682 764 [INFO ] -
    2021-02-04 09:42:37,697 764 [ERROR] - Failures
    2021-02-04 09:42:37,697 764 [ERROR] -  - vlc (exited 1) - vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    2021-02-04 09:42:37,697 764 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
    2021-02-04 09:42:37,732 764 [DEBUG] - Exiting with 1
    

    How do I get a working Artifactory cache of Chocolatey without a 404?

    I have downloaded the Artifactory logs and grepped for choco:

    $ grep choco *.log
    access.log:2021-02-04 15:31:38,164 [DENIED DOWNLOAD] chocolatey-remote-cache:vlc.3.0.12.nupkg  for client : NA / 91.180.197.91.
    artifactory.log:2021-02-04 10:57:28,154 [http-nio-8081-exec-992] [INFO ] (o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64) - Updating repository chocolatey-remote
    artifactory.log:2021-02-04 14:36:56,347 [http-nio-8081-exec-1053] [INFO ] (o.a.u.r.s.a.c.r.UpdateRepositoryConfigService:64) - Updating repository chocolatey-remote
    request.log:20210204153137|124|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote|HTTP/1.0|200|0
    request.log:20210204153137|4|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/$metadata|HTTP/1.0|200|0
    request.log:20210204153138|128|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/Packages()|HTTP/1.0|200|0
    request.log:20210204153138|16|REQUEST|91.180.197.91|anonymous|GET|/api/nuget/chocolatey-remote/Download/vlc/3.0.12|HTTP/1.0|404|0
    

    The line [DENIED DOWNLOAD] chocolatey-remote-cache:vlc.3.0.12.nupkg looks relevant to the issue, but I'd need an Artifactory expert to help me understand what it means.

    I ran the choco command exactly like @yahavi in answer below:

    PS C:\Users\vagrant> choco install vlc --source=https://<ARTIFACTORY>/api/nuget/chocolatey-remote --user=***REDACTED*** --password=***REDACTED***
    Chocolatey v0.10.15
    Installing the following packages:
    vlc
    By installing you accept licenses for the packages.
    vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    vlc package files install completed. Performing other installation steps.
    The install of vlc was NOT successful.
    vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    
    Chocolatey installed 0/1 packages. 1 packages failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
    
    Failures
     - vlc (exited 1) - vlc not installed. An error occurred during installation:
     The remote server returned an error: (404) Not Found. Not Found
    

    As a sanity check, I also did choco install vlc --source=https://chocolatey.org/api/v2/ and that worked. This rules out any issue on Chocolatey's side, it's most definitely an issue with Artifactory.

    解决方案

    Try to set the NuGet v3 Feed URL to be the default value: https://api.nuget.org/v3/index.json.

    We use Artifactory as a caching mechanism for Chocolatey in our tests.The usage is not exactly like yours, since we add the connection details in the install command:

    choco install vlc -s <jfrog-url>/api/nuget/chocolatey-remote -u <username> -p <password>
    

    To get more information, you're welcome to read my blog:https://jfrog.com/blog/artifactory-as-a-caching-mechanism-for-package-managers/

    这篇关于如何将Artifactory配置为Chocolatey的缓存?安装软件包时得到404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 18:21