404 on nuget packages link

2019-02-25 01:43发布

问题:

Full disclaimer: java guy, trying on the .Net hat...

I've gone through the walk through on how to setup NuGet server, and it looks like it is mostly working. I get this page:

You are running NuGet.Server v1.8.30423.9026

Click here to view your packages. 

However, when I click the link I get a 404. The .nupkg mime type has been added to IIS, so I don't see what else I could be doing wrong. I've added NLog to the project and added logging to the Routes.cs class and both the log statements are showing up:

private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

public static void Start() {
    Logger.Info("Start called in CompanyNameHereNuget");

    MapRoutes(RouteTable.Routes);
}

private static void MapRoutes(RouteCollection routes) {
    Logger.Info("MapRoutes called in CompanyNameHereNuget");

    // The default route is http://{root}/nuget/Packages
    var factory = new DataServiceHostFactory();
    var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
    serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
    serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
    routes.Add("nuget", serviceRoute);
}

private static PackageService CreatePackageService() {
    return NinjectBootstrapper.Kernel.Get<PackageService>();
}

Is there some other log file I should be looking at? I've looked at the folder: C:\inetpub\logs and none of the log files there even have recent time stamps. Or maybe I'm missing something obvious in the setup?

回答1:

I was actually looking into why Elmah wasn't logging anything and found this thread:

http://forums.asp.net/t/1800305.aspx/1

And this suggestion:

Are you using classic or integrated app pool? Check if it's classic. If it is then your httpmodules and httphandlers won't be set because that's an integrated definition and not a classic definition.

After changing the setting on the server (from classic to interactive), voila, it worked!