You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Win2008迁移至Win2016后NuGet Server推送报404错误求助

Troubleshooting NuGet Push 404 Error After Migrating to IIS 10 (Windows Server 2016)

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 NugetFeed site.
  • Go to Request Filtering > HTTP Verbs tab.
  • Ensure PUT and DELETE are 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.PageHandlerFactory or 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 NugetFeed site > Failed Request Tracing Rules > Add a rule to trace 404 status codes.
  • Run the nuget push command 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 packagePath in Web.config correctly points to D:\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 appSettings section for apiKey and allowAnonymousPush:
    <add key="apiKey" value="D568CD48-1609-40C9-9A5D-7ADC808129E5" />
    <add key="allowAnonymousPush" value="false" />
    
    While your error is 404 (not unauthorized), confirming these values eliminates permission-related edge cases.

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:42:52