首页 > 解决方案 > VS 2019 发布问题 - 无法加载源 https://api.nuget.org/v3/index.json 的服务索引

问题描述

当我尝试发布特定解决方案时遇到问题。

相关:

  1. 我已经能够发布/部署大约 6 个没有问题的解决方案。
  2. 当我尝试发布时给我带来问题的解决方案在我的本地 VS 2019 上运行 100%,问题是发布
  3. 这是我在 VS 2019 上从新创建的第一个解决方案。所有其他解决方案都是在 VS 2017 上创建的
  4. 我可以在浏览器中运行 - https://api.nuget.org/v3/index.json
  5. 我确实尝试过运行 NuGet 包还原
  6. 我确实尝试实施我在研究时发现的不同解决方案

如果你谷歌搜索“请求被中止:无法创建 SSL/TLS 安全通道”的错误,你会看到很多文章。我尝试了详细的解决方案,显然没有运气。

...

1>------ Publish started: Project: HFSPackagesApi, Configuration: Release Any CPU ------
Connecting to C:\deployments\HFSPackagesApi...
Determining projects to restore...
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(128,5): Error : Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  The request was aborted: Could not create SSL/TLS secure channel.
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1004: Assets file 'F:\source\BitBucket\gmborl\LiveBackup\ReleaseInsightApp\HFSPackagesApi\HFSPackagesApi\obj\publish\win-x64\project.assets.json' not found. Run a NuGet package restore to generate this file.

1>Build failed. Check the Output window for more details.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

...

标签: visual-studio-2019publish

解决方案


通过执行支持文章中概述的以下步骤在 Windows 7 中修复它:

步骤1

添加一个名为 to的DWORD注册表项:DefaultSecureProtocols0x00000a00

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

注意:Wow6432Node仅在 64 位 Windows 上需要第二个 (in )。

第2步

创建子键:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client

在它们中的每一个中添加一个DWORD名为的条目DisabledByDefault,其值为0

注意:您可能需要创建TLS 1.x密钥和Client密钥。


推荐阅读