简体   繁体   English

Nuget 资源从 https 更改为 http

[英]Nuget resource change from https to http

I try to upload a NuGet package but a receive this error:我尝试上传 NuGet 包,但收到此错误:

An error was encountered when fetching 'PUT http://nuget_domain/api/v2/package/'.获取“PUT http://nuget_domain/api/v2/package/”时遇到错误。 The request will now be retried.现在将重试该请求。

But in the https://nuget_domain/v3/index.json is 'https://nuget_domain/api/v2/package'但是在 https://nuget_domain/v3/index.json 中是“https://nuget_domain/api/v2/package”

Y want to know why it tries with http with it is configurated with https and how to fixed.你想知道为什么它尝试使用 http 配置 https 以及如何修复。

Regards问候

1) First , please use the latest nuget.exe cli v5.7.0 from this link . 1) 首先,请使用此链接中最新的nuget.exe cli v5.7.0 Download it into the local path.下载到本地路径。 And then copy its path into System Environment Variable PATH so that it can be called from CMD .然后将其路径复制到系统环境变量PATH以便可以从CMD调用它。

2) Second , run this command under CMD to add your private nuget package source with username and password into the global nuget.config file. 2) 其次,在 CMD 下运行此命令,将带有usernamepassword私有 nuget 包源添加到全局nuget.config文件中。 When you push a nuget package by CMD, it will read the file first so that you don't need to add some extra instructions.当你通过 CMD 推送一个 nuget 包时,它会先读取文件,这样你就不需要添加一些额外的指令。

Before that , you should pay attention to your nuget sever path.在此之前,您应该注意您的nuget sever 路径。 Make sure that the link is right, you can also type the path into website to check whether it could return something.确保链接正确,您也可以在网站中键入路径以检查它是否可以返回某些内容。

nuget sources add -Name "nuget path" -Source "https://nuget_domain/v3/index.json" -username "xxxx" -password "xxxx"

add your username and password of the private nuget sever.添加您的私人 nuget 服务器的用户名和密码。

If you want to update this nuget source, you could run:如果要更新此 nuget 源,可以运行:

nuget sources update -Name "nuget path" -Source "xxxx" -username "xxxx" -password "xxxx"

3) Third , then push the nuget package like this, 3)第三,然后像这样推送nuget包,

nuget push xxx\xxx.nupkg -Source "nuget path" 

Besides , if it still does not work, please try to use Step 2 to change your nuget package source to https://nuget_domain/ .此外,如果还是不行,请尝试使用第2步将您的nuget包源更改为https://nuget_domain/ Not sure whether it works and hint from this github link .不确定它是否有效并从这个 github 链接中提示。

==================== ====================

If you use dotnet to push a nuget package, you could use this command:如果您使用 dotnet 推送 nuget 包,则可以使用以下命令:

dotnet push xxx\xx.nupkg -s https://nuget_domain/v3/index.json --api-key xxxx --skip-duplicate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM