How to configure internal Nuget feed

I’ve installed an internal Nuget feed and can browse to it quite happily using anonymous credentials and see my packages. However, when I try to configure Octopus to use it, when I click the Test button and try to search for a package, I get the following error message:

There was a problem processing your request: 400 Could not connect to the feed specified at ‘http://myserver/nuget/’. Please verify that the packa…

The feed is hosted using Nuget.Server.2.5.0.1.

Am I putting in the wrong query? If my .nupkg is called MyProject.Website.1.2.345.6.nupkg, what should I be searching for in the Test screen?

Hi,

Can you try taking the “/nuget” segment out of the URI when you register the feed with Octopus? NuGet does some strange things to calculate the API endpoint which might break with your /nuget segment.

Paul

The feed is hosted in a virtual directory named /nuget, so presumably the actual package list would be at http://myserver/nuget/nuget; so maybe if I were to renamed the vdir to something like /packages or /deployment then that would help Octopus?

I changed the vdir to http://myserver/packages/ and the test page still returned a 400 error. I then added another nuget to the path to make it http://myserver/packages/nuget, which is the path I would add to Visual Studio if I wanted to integrate my repository, and it worked.

I just thought to check the event log, and behold there are events with stack traces for this error. Looking at the stack trace, perhaps it would be worth putting some smarts into Octopus.Portal.Areas.Api.Controllers.PackagesController.SearchForPackagesNamedLike so that it a System.Data.Services.Client.DataServiceClientException is thrown (which was what was happening here) with an HTTP 404 status code and the path does not end in /nuget, it would be worth trying the request again with a /nuget appended? Or if in my original case, the path did end with /nuget, appending another one anyway and trying? It just makes Octopus that little bit more idiot proof :slight_smile:

Hmm, maybe I spoke too soon; although the configuration for the internal nuget feed is now good, and the test functionality returns packages from the repository, when I try to run an actual deployment, I get 404 errors when Octopus tries to download the .nupkg files.

The error in the log is:

@@@
2013-06-25 07:18:56 DEBUG Checking package cache for package MyProject 6.3.0
2013-06-25 07:18:56 INFO Downloading NuGet package MyProject 6.3.0 from feed: 'http://myserver/deployment/nuget
2013-06-25 07:18:56 DEBUG Downloaded packages will be stored in: C:\Octopus\Data\PackageCache\feeds-1
2013-06-25 07:18:56 DEBUG Finding package (attempt 1 of 5)
2013-06-25 07:18:56 DEBUG Found package MyProject version 6.3.0
2013-06-25 07:18:56 DEBUG Downloading to: C:\Octopus\Data\PackageCache\feeds-1\MyProject.6.3.0_8DD16127C1A3514AAD5B24A16878317C.nupkg
2013-06-25 07:18:56 ERROR Unable to download package: The remote server returned an error: (404) Not Found. System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at NuGet.RequestHelper.GetResponse(Func1 createRequest, Action1 prepareRequest, IProxyCache proxyCache, ICredentialCache credentialCache, ICredentialProvider credentialProvider)
at NuGet.HttpClient.GetResponse()
at NuGet.HttpClient.DownloadData()
at NuGet.PackageDownloader.DownloadPackage(IHttpClient downloadClient, IPackageMetadata package)
at NuGet.DataServicePackage.EnsurePackage(IPackageRepository cacheRepository)
at NuGet.DataServicePackage.GetStream()
at NuGet.FileSystemExtensions.AddFileWithCheck(IFileSystem fileSystem, String path, Func`1 streamFactory)
at Octopus.Shared.Packages.PackageDownloader.AttemptToFindAndDownloadPackage(Int32 attempt, PackageMetadata packageMetadata, IFeed feed, IActivityLog log, String cacheDirectory, IPackage& downloadedPackage, String& path) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Packages\PackageDownloader.cs:line 127
at Octopus.Shared.Packages.PackageDownloader.AttemptToDownload(PackageMetadata metadata, IFeed feed, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Packages\PackageDownloader.cs:line 84
@@@

Hi David,

I think a MIME mapping may be missing on your NuGet server - can you check this thread for details?

Paul

The link you posted nudged me in the right direction; the server I am hosting the Nuget feed on is running Windows Server 2003, so it does not support the extensionless paths of a modern ASP.NET MVC app - enabling wildcard extensions fixed that, and now I can download Nuget packages and deploy them to my tentacle.

A great piece of software, and seems to get good word-of-mouth too.

Thanks David, and thanks for sharing your solution. Glad it’s working!

Paul