NuGet.Server returns 404 error

2020-02-28 03:19发布

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.

10条回答
干净又极端
2楼-- · 2020-02-28 03:55

I noticed that you get the 404 error when you try to upload fairly large nuget packages. I upped the maxAllowedContentLength and it helped.

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="31457280"/>
    </requestFiltering>
  </security>
</system.webServer>
查看更多
smile是对你的礼貌
3楼-- · 2020-02-28 03:56

I was having this problem today. Actually what I need to do is this in Global.asax:

void Application_Start(object sender, EventArgs e) 
{
    NuGetRoutes.Start();
}
查看更多
【Aperson】
4楼-- · 2020-02-28 03:57

I had this problem with a clean Visual Studio 2017 Web project.

Recreating from Visual Studio 2015 and targeting .NET 4.6.1 sorted it out

查看更多
啃猪蹄的小仙女
5楼-- · 2020-02-28 03:59

If you create a new empty VB project you will also get a 404 (in Packages and browsing using NuGet Manager).

You appear to have to create the project as C# and it works as advertised!

And yet the source code appears identical :(

查看更多
登录 后发表回答