Win2008迁移至Win2016后NuGet Server推送报404错误求助
Let's break down the most likely causes for this 404 issue—since browsing packages works fine but push fails, this points to a problem with API endpoint handling rather than basic site availability.
1. Verify HTTP Verb Permissions in IIS
NuGet push relies on the PUT HTTP verb, which IIS 10 might not enable by default for your NuGetFeed site. Here's how to check:
- Open IIS Manager, navigate to your
NugetFeedsite. - Go to Request Filtering > HTTP Verbs tab.
- Ensure
PUTandDELETEare allowed (not listed in the "Denied" section). If missing, add them explicitly to the allowed verbs list.
2. Use the Correct NuPush API Endpoint
Most NuGet.Server implementations require pushing to a dedicated API endpoint, not the feed's root URL. Try modifying your push command to target the v2 package endpoint:
nuget push FEDivaNET.dll*.nupkg -Source http://xyz.mycompany.com/NugetFeed/api/v2/package D568CD48-1609-40C9-9A5D-7ADC808129E5
The root URL (/NugetFeed/) is for browsing, but push operations need to hit the specialized API route—this is a common oversight during migrations.
3. Check IIS Module Mappings & ASP.NET Integration
Since you're using IIS 10's integrated pipeline mode, confirm the necessary ASP.NET modules are registered for your site:
- Go to your site's Handler Mappings and verify that ASP.NET 4.x handlers (like
System.Web.UI.PageHandlerFactoryor NuGet's Web API/WCF handlers) are present and enabled. - Ensure your application pool uses the correct .NET Framework version matching your NuGet.Server build (e.g., .NET 4.6.2 for newer NuGet.Server releases).
4. Enable IIS Failed Request Tracing to Diagnose the 404
To get granular details about why the 404 is occurring, enable Failed Request Tracing:
- In IIS Manager, right-click your
NugetFeedsite > Failed Request Tracing Rules > Add a rule to trace 404 status codes. - Run the
nuget pushcommand again, then open the generated trace log. Look for the exact request path being processed—this will show if the request is hitting the wrong route, missing a handler, or failing at any stage of IIS processing.
5. Double-Check NuGet.Server Web.config Settings
Even if you copied settings from the old server, some configurations might need adjustment for IIS 10:
- Confirm the
packagePathin Web.config correctly points toD:\MyServer\NugetPackages. Ensure the application pool identity (e.g.,IIS AppPool\NugetFeed) has modify/write permissions to this folder (avoid overusing "Everyone"—stick to least privilege principles). - Check the
appSettingssection forapiKeyandallowAnonymousPush:
While your error is 404 (not unauthorized), confirming these values eliminates permission-related edge cases.<add key="apiKey" value="D568CD48-1609-40C9-9A5D-7ADC808129E5" /> <add key="allowAnonymousPush" value="false" />
6. Test with a Minimal NuGet.Server Deployment
Since you tried multiple NuGet.Server versions, deploy a fresh, unmodified instance of NuGet.Server 3.1.2 to a new IIS application on your server. Push a test package to this fresh instance—if it works, the issue lies with your migrated site's config or IIS settings, not the server itself.
内容的提问来源于stack exchange,提问作者Jack

