Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Server responds with (405) Method Not Allowed while pushing or deleting a package

I am getting a (405) Method Not Found error when attempting to push a package to my locally hosted Nuget Server (Nuget.Server package) hosted on IIS 7.5 on Windows 2008 R2 Enterprise.

There is a dedicated IIS site configured for the nuget server (Called Nuget) and bound to a specific port (81 for fun).

The app pool is setup to be .NET Framework 4.0 and is in Integrated Pipeline mode.

I understand that I might need to enable PUT and DELETE verbs but have no idea which handler is responsible for handling the Nuget requests.

like image 969
Norman H Avatar asked Jan 10 '13 16:01

Norman H


2 Answers

In integrated pipeline mode, the correct handler is the svc-Integrated-4.0 handler.

I found this out by trial and error and by reading through the source code of the Nuget Server on Codeplex.

This article on how ASP.NET processes your requests is also very helpful in understanding what is taking place under the covers.

Additionally, for this answer to be the correct one, you need to ensure that the application pool is in Integrated Pipeline mode and not Classic mode.

The relevant section of your Web.config that will need to change is listed below, specifically the list of verbs that are now supported.

<system.webServer>
    <handlers>
        <remove name="svc-Integrated-4.0" />
        <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
        <add name="svc-Integrated-4.0" path="*.svc" verb="GET,PUT,POST,DELETE,DEBUG" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
</system.webServer>
like image 98
Norman H Avatar answered Nov 11 '22 01:11

Norman H


Adding <remove name="WebDAVModule" /> to system.webServer/modules worked fine for me.

like image 3
Dmitrii Avatar answered Nov 11 '22 00:11

Dmitrii