Unwanted port part in the feed.entry.content.src

Feb 8, 2012 at 9:57 AM

Dear Developers,


Our website "http://nuget.webfiok.hu" is associated with 29047 port in the bindings of our ISS settings, but this port is not visible from the internet side.We deployed and configured a nuget server into this website for our proprietary libraries, the NuGet.exe LIST worked properly, but the NuGet.exe INSTALL throwed an "Unable to connect to the remote server" error.


When we browsed the packages on this site we saw in the feed.entry.content.src an unwanted port part ":29047", how can we remove this from there ?

I modified the src\Core\Packages\DataServicePackage.cs at the internal IPackage DownloadAndVerifyPackage(IPackageRepository repository) ~line 345from : package = Downloader.DownloadPackage(DownloadUrl, hashBytes, this);To:    Uri downloadUrl = new Uri(DownloadUrl.AbsoluteUri.Replace(":29047",""));       package = Downloader.DownloadPackage(downloadUrl, hashBytes, this);and I rebuild the NuGet.exe the new INSTALL command worked properly.


How can I determine from a port that it is used or not in the URL and where can I modified the server code for this reason ?

I saw in src\Server\DataServices\Packages.svc.cs at the public Uri GetReadStreamUri(object entity, DataServiceOperationContext operationContext) ~line 60  var rootUrl = context.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);but I not found the assigment of feed.entry.content.src (SyndicationItemProperty).


Thanks a lot,Attila Szomor.


Example NuGet.exe runs and their results:

-----------------------------------------

C:\NuGetTools\CommandLine>NuGet.exe list RB.Program.EuropaTeszt.Client /Source http://nuget.webfiok.hu/nuget

RB.Program.EuropaTeszt.Client 1.0.4294.19473


C:\NuGetTools\CommandLine>NuGet.exe install RB.Program.EuropaTeszt.Client /Version 1.0.4294.19473 /Source http://nuget.webfiok.hu/nuget /OutputDirectory Packages

Attempting to resolve dependency 'RB.Program.Lib.Client (> 4.0.30319.1)'.

Unable to connect to the remote server


C:\NuGetTools\CommandLine>NuGet.exe install RB.Program.Lib.Client /Version 4.0.30319.1 /Source http://nuget.webfiok.hu/nuget /OutputDirectory Packages

Unable to connect to the remote server

BROWSE http://nuget.webfiok.hu/nuget/Packages

---------------------------------------------

<feed xml:base="http://nuget.webfiok.hu/nuget/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">

  <id>http://nuget.webfiok.hu/nuget/Packages</id>

  <entry>

    <id>http://nuget.webfiok.hu/nuget/Packages(Id='RB.Program.EuropaTeszt.Client',Version='1.0.4294.19473')</id>

    <content type="application/zip" src="http://nuget.webfiok.hu:29047/api/v2/package/rb.program.europateszt.client/1.0.4294.19473" />

...

Feb 16, 2012 at 6:27 AM

I ran in to the same issue. I was trying to follow these instructions http://blog.maartenballiauw.be/post/2011/11/08/Rewriting-WCF-OData-Services-base-URL-with-load-balancing-reverse-proxy.aspx to modify the requests coming in so that the OData feed sees the URL without the port included, and it worked for almost all of the properties in the atom feed (feed xml:base, id, etc. are all correct).  The only thing that was not correctly updated was the <content src="http://localhost:49467"> link to the actual package.

I traced this down in the code and I think the "GetReadStreamUri" method of src\Server\DataServices\Packages.svc.cs should be using either:

OperationContext.Current.IncomingMessageProperties["MicrosoftDataServicesRootUri"]

or

OperationContext.Current.IncomingMessageProperties["MicrosoftDataServicesRequestUri"]

Instead of the HttpContext to build the URI, but I haven't spent a lot of time with OData or the Nuget.Server code so I'm not really sure.  I'm hoping someone with more experience in those areas can comment and perhaps submit a patch for the next release?  I was hoping I could make all my modifications by extending classes rather than having to modify the NuGet.Server source code...

Mar 19, 2012 at 8:30 AM

Dear Developers,

I think you are near to an issue, but I can not see solution of the load balanced or simply forwarded  server's URL handling in Packages.svc.cs.

Can you put a rootUrl key into appSettings and handling it in Packages.svc.cs? 

Thanks,

Attila.