部署 IronPDF NuGet 软件包:修复
尝试部署 NuGet 包时,您可能会看到以下一个或多个错误信息:
Failed to deploy NuGet package '_IronPdf.Native.Chrome.Windows(version)'System.Net.WebException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host可能原因
这些错误的最常见原因与过时的 TLS 协议有关。 截至2020年6月15日,NuGet 已取消对 TLS 1.0 和 1.1 的支持,并强制执行 TLS 1.2。如果您的系统上未启用 TLS 1.2,则 NuGet 命令可能会失败。
如果未启用 TLS 1.2,则从 HTTP 切换到 HTTPS 不会解决问题,因为 NuGet 现在需要安全连接。
解决方案
安装 Visual C++ 运行库: 确保您的系统上安装了Visual Studio 的 Visual C++ 可再发行组件。 缺少运行库可能会导致某些包的问题,包括 IronPDF。
更新 Visual Studio: 确保您使用的是最近的、最新版本的 Visual Studio。 Visual Studio 2015 或更高版本需要正确支持现代 TLS 协议。
- 在 Visual Studio 中,前往:
- 工具 > 扩展和更新 > 更新 > Visual Studio Gallery
- 将 NuGet 包管理器更新到最新版本。
- 在 Visual Studio 中,前往:
在 .NET 中启用强加密: 如果上述步骤未解决问题,您可能需要在 .NET 中启用强加密。 这可以通过修改注册表来完成。
创建一个包含以下内容的
.reg文件:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319] "SchUseStrongCrypto"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319] "SchUseStrongCrypto"=dword:00000001- 上述注册表项启用了 32 位和 64 位版本的 .NET 中的强加密。
- 运行
.reg文件以更新注册表设置。 这在 .NET 中启用强加密,允许 TLS 1.2 连接。
无需重启。 应用这些更改后,请尝试再次运行您的 NuGet 命令。
有关更多详细信息,请参考此 Stack Overflow 帖子:NuGet 失败:基础连接已关闭:发生了意外错误。
如果您需要进一步的帮助,请通过提交 工程请求联系我们。






