将 nuget 包推送到 Nuget.Server 时出现错误 411

Error 411 on pushing nuget package to Nuget.Server

我已从 http://nugetserver.net 成功设置 Nuget.Server。 我可以访问 http://localhost/ site and http://localhost/nuget/Packages。 不幸的是,每个 nuget push 都会导致以下错误:

Pushing Sample.1.1.0.nupkg to 'http://localhost/api/v2/package'...
  PUT http://localhost/api/v2/package/
  LengthRequired http://localhost/api/v2/package/ 33ms
Kod stanu odpowiedzi nie wskazuje powodzenia: 411 (Length Required).

看起来 nuget 客户端没有设置 Content-Length header 所以 IIS 正在抱怨。 我该如何解决?

就我而言,这是因为在代理后面。代理不会转发所有信息。删除代理后,服务器将正常接受放置请求。

我刚遇到同样的错误 411 (Length required),我的问题是我设置了 -src https://nuget.org 但这是错误的,它需要 -src https://www.nuget.org