I have followed the instructions to setup and host my own NuGet feed. I am running the web application on a Windows 2012 (IIS 8.5) box.
I build and run the solution and get the default.aspx page...
Which says "You are running NuGet.Server v2.8.60318.667" and "Click here to view your packages".
When I click on the "here" link I get a "404 - File or directory not found." error.
- I can successfully run a nuget.exe push command to put packages on the Nuget server; however I get a 404 error when attempting to run nugget.exe list command.
- I have restarted IIS and the server
- I have rebuilt the NuGet.Server web application from scratch.
- I have tried hosting the NuGet.Server on a Windows 7 box with no success.
The Web.Config has the following entry
<modules runAllManagedModulesForAllRequests="true">
The web.config also has an entry to register the .nupkg extension as mimeType="application/zip"
It seems like the url routing is not working, but I can't seem to pin down what I am doing wrong. Something is preventing the odata feed from working.
I know there are great 3rd party implementations of NuGet server, but I would really like to just get the free one working and it seems like it should be so easy. Any thoughts or troubleshooting tips would be appreciated.
FWIW, I made the mistake of trying to fetch the packages from http://[server]/nuget/Packages and got the same error. Removing /Packages from the end of the source URL was the answer, so http://[server]/nuget is the correct url.
This answer expands the comment left on AndrewD's answer.
Like him, I started out with a VB project and I ended up in the same camp as OP. What worked for me however was converting all C# code into VB, within these two files.
For the sake of completion, I'm including the post-converted contents of these files below.
Default.aspx
NuGetODataConfig.vb
I was having similar issue and I found a solution! I created a private nuget server following the instructions to create an empty ASP.NET project (I'm on VS2015) and then installing nuget.server (currently v2.11.3.0). I was able to run and see web page except I was not able to use "nuget.exe push" to upload packages. I got the dreaded 404 not found error.
I eventually cloned the nuget.server source code off github and ran that directly which worked fine!? I discovered my
web.config
was incorrect. For me the key line wasin the
section.
I suggest anyone having issues should go to github and compare web.config files.
BTW: The
nuget.server
install is supposed to replace yourweb.config
. This may not have worked correctly for me.If you name you project Nuget.Server, since your generated dll will be Nuget.Server.dll it will not work because Nuget.Server.dll is the actual dll for the server. Rename your Assembly name to something else.
The NuGet.config file in either %APPDATA%\NuGet or $(SolutionDir).nuget may be referring to unexpected "active source" URLs. For example, the nuget.exe brought by the TFS build agent install might be aware of NuGet v2 protocol only while the URLs refer to v3 protocol. Or the custom NuGet server URL might be missing from NuGet.config.
I have one answer not mentioned in either of the posts I've found. If you name your project Nuget.Server, even though publishing will work in IIS, ninject will fail to set up the package list route because it will try to load the wrong DLL and error out.
Here are some other possible answers:
Possible Answers 1
Possible Answers 2