Visual Studio使用HTTP而不是HTTPS Nuget feed [英] Visual studio use HTTP instead of HTTPS Nuget feed

查看:164
本文介绍了Visual Studio使用HTTP而不是HTTPS Nuget feed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在https网址上创建了一个nuget teamcity Feed:&bbsp; b

[https:// teamcity:xyz / httpAuth / app / nuget / v1 / FeedService.svc /] [1]
$


当我在visual studio中推送到这个url或list包时,它可以工作,但是当我从包管理控制台安装包或visual studio中的visual nuget包管理工具我看到它尝试从http feed下载但是这不是
工作并且给出超时因为teamcity只是打开并允许在https端口。



 

 从'SAI'检索包'Test 1.0.0'。 
      GET    http:// teamcity:xyz / httpAuth / app / nuget / v1 / FeedService.svc / download / Package / 4646:i    d / Test.1.0.0.0.nupkg

   我收到超时:
   从'TEST'中检索包'Test 1.0.0'。
      GET      http:// teamcity:xyz / httpAuth / app / nuget / v1 / FeedService.svc / download / Test / 4646:id / T    est.1.0.0.0.nupkg
    .... 
    ...
   在100000ms之后超时。






那么,为什么Visual Studio使用http?当我查看nuget配置文件时,我可以看到Feed网址配置了HTTPS?
$


  &NBSP; < packageSources>

  &NBSP;  < add key =" nuget.org"值= QUOT; HTTPS://api.nuget.org/v3/index.json" protocolVersion = QUOT; 3英寸/>

  &NBSP;  < add key =" nuget.org"值= QUOT; HTTPS://www.nuget.org/api/v2/" />

  &NBSP;  < add key =" TEST"值= QUOT; https://开头的TeamCity:XYZ / httpAuth /应用程序/的NuGet / V1 / FeedService.svc /" />

  &NBSP; < / packageSources>



$
  [1]:https:// teamcity:xyz / httpAuth / app / nuget / v1 / FeedService.svc /


解决方案

嗨Jo Bouillon,


感谢您在此发帖。


>>> 为什么Visual studio是使用http?当我查看nuget配置文件时,我可以看到源URL配置了HTTPS?


这是因为TeamCity服务器返回一个http url供下载,并且nuget .exe / visual studio扩展只是按照链接。在这种情况下,Visual studio / nuget不使用HTTPS配置的feed并改为使用HTTP。


此外,NuGet服务器(nuget.org)和teamcity仅允许在https端口上,所以由于http://不正确,所有的feed链接和auth都会搞砸,并会被重定向到https://。这也意味着不会重新发送auth标头,因此它会导致
重定向循环。然后我们将得到超时问题。


要解决此问题,您可以尝试修改//conf/server.xml部分以包含最后3个属性以使其正常运行在SSL终止代理后面:

< Connector port =" 8080"协议= QUOT; org.apache.coyote.http11.Http11NioProtocol" 
connectionTimeout =" 60000"
redirectPort =" 8543"
useBodyEncodingForURI =" true"
socket.txBufSize =" 64000"
socket.rxBufSize =" 64000"
tcpNoDelay =" 1"
secure =" true"
scheme =" https"
proxyPort =" 443"
/>




有关更多详细信息,请参阅
关于GitHub的问题




I have created a nuget teamcity feed on a https url : 

[https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/][1]

When I push to this url or list package in visual studio it works but when I install the package from the package management console or the visual nuget package management tool in visual studio I see that it try to download from http feed but this does not work and give a timeout because the teamcity is only open and allow on https port.

 

   Retrieving package 'Test 1.0.0' from 'SAI'.
      GET     http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Package/4646:i    d/Test.1.0.0.0.nupkg

    I receive a timeout :
    Retrieving package 'Test 1.0.0' from 'TEST'.
     GET       http://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/download/Test/4646:id/T    est.1.0.0.0.nupkg
    .... 
    ...
    has timed out after 100000ms.



So, why Visual studio is using http? When i look in the nuget config file I can see that the feed url is configured with HTTPS?

    <packageSources>
     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
     <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
     <add key="TEST" value="https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/" />
    </packageSources>


  [1]: https://teamcity:xyz/httpAuth/app/nuget/v1/FeedService.svc/

解决方案

Hi Jo Bouillon,

Thanks for posting here.

>>>why Visual studio is using http? When i look in the nuget config file I can see that the feed url is configured with HTTPS?

That is because the TeamCity server return an http url for download, and nuget.exe/visual studio extension just follows the link. In this case, Visual studio/nuget is not using the HTTPS configured feed and use HTTP instead.

Besides, NuGet server (nuget.org) and teamcity are only allow on https port, so all the feed links and auth would be messed up since http:// is incorrect and will get redirected to https://. This also means the auth header isn't re-sent, so it results in a redirected loop. Then we will get the time out issue.

To resolve this issue, you can try to modify the //conf/server.xml section to include the last 3 attributes to make it behave properly behind an SSL-terminating proxy:

<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
       connectionTimeout="60000"
       redirectPort="8543"
       useBodyEncodingForURI="true"
       socket.txBufSize="64000"
       socket.rxBufSize="64000"
       tcpNoDelay="1"
       secure="true"
       scheme="https"
       proxyPort="443"
/>


For more detail information, you can refer to the issue on GitHub


这篇关于Visual Studio使用HTTP而不是HTTPS Nuget feed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆