Change Set bab214e5bf8a - Updating server to use PUT instead of POST to push packages. (Causing Error 405 - Method Not Allowed)

Dec 15, 2011 at 11:25 PM

After updating my nuget.exe to the latest version I can no longer push to the Nuget.Server package on IIS or running in debug mode under visual studio 2010.  In both cases I get a Error 405 - Method Not Allowed.  If I roll back to before this change everything works so it looks like maybe the Nuget.Server is not setup for PUT?  Any help please.  Thanks so much.

 

Developer
Dec 15, 2011 at 11:53 PM

Is your NuGet.Server also updated to 1.6? The new server ought to work with PUT.

Dec 16, 2011 at 6:21 AM

I have the same problem, update Nuget.Server to 1.6 and after this, also got the 405's Method Not Allowed...

Dec 16, 2011 at 5:59 PM
pranavkm wrote:

Is your NuGet.Server also updated to 1.6? The new server ought to work with PUT.


Yes I updated the NuGet.Server to 1.6 as well using NuGet.  I even did a new Clean 1.6 install on an empty web site to be sure it was not an upgrade issues.  Thanks.

Dec 16, 2011 at 8:11 PM

It would appear NuGet 1.5 used a POST and NuGet 1.6 now uses a PUT, which by default no IIS configs would allow out of the box.  I upgraded both the command-line exe and the NuGet ASP.NET application to use 1.6 (with NuGet.Server 1.6 package)

If there is a valid reason to switch to put and they are going to keep it this way, some installation notes would be helpful for IIS6 & IIS7 users on what to change.  The extension mapping config defaults in IIS6 for ASP.NET4 only GET,POST,HEAD,DEBUG.  I tried adding PUT, but failed, and ran out of my "window" for upgrade time & users who needed to get work done.

Two IIS logs showing one POST from before my upgrade today, and the PUT after, with details XXXXX'd out:

NuGet 1.5:
2011-12-16 20:40:00 W3SVC1 IP.XXX.XXX.XXX POST /ng/PackageFiles/XXXXX-APIKEY-XXXXXX/nupkg - 80 - 10.245.72.254 NuGet+Command+Line/1.5.21005.9019+(Microsoft+Windows+NT+5.2.3790+Service+Pack+2) 200 0 0 

NuGet 1.6:
2011-12-16 20:45:43 W3SVC1 IP.XXX.XX.XXX PUT /ng/ - 80 - 10.245.72.254 NuGet+Command+Line/1.6.21205.9031+(Microsoft+Windows+NT+5.2.3790+Service+Pack+2) 405 0 0

Developer
Dec 16, 2011 at 10:34 PM
Edited Dec 16, 2011 at 11:14 PM

The change to PUT was a part of our effort to make our services more RESTful and feed discovery easier.

I tried this with IIS 7 (right now and while developing) and it does works without any additional config requirements. What happened when you added a PUT to the Isapi handler? Does it continue to return 405s?

 

Edit: Woops, fixing incomplete statement.

Dec 16, 2011 at 10:39 PM

Effort to make what? :)

Dec 18, 2011 at 8:06 PM

Can you be a little more clear on what to configure?  I'm not sure what mappings need to be updated and where.  I am also having this problem and will be forced to fall back to Nuget 1.5 for now if I can't get this solved.

Dec 19, 2011 at 4:28 AM

Ok I'm also having the same issue here.

Adding the PUT verb to the Isapi handler now means the request is accepted but simply returns the main page.

The message from Nuget.exe is "Failed to process request. 'OK'."

The fiddler response from the PUT request is:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 19 Dec 2011 05:17:04 GMT
Connection: close
Content-Length: 1228

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
	NuGet Private Repository
</title>
    <style>
        body { font-family: Calibri; }
    </style>
</head>
<body>
    <div>
        <h2>You are running NuGet.Server v1.6.21205.9031</h2>
        <p>
            Click <a href="/Nuget/nuget/Packages">here</a> to view your packages.
        </p>
        <fieldset style="width:800px">
            <legend><strong>Repository URLs</strong></legend>
            In the package manager settings, add the following URL to the list of 
            Package Sources:
            <blockquote>
                <strong>http://XXX/Nuget/nuget</strong>
            </blockquote>
            
            Use the command below to push packages to this feed using the nuget command line tool (nuget.exe).
            
            <blockquote>
                <strong>nuget push {package file} -s http://XXX/Nuget/ {apikey}</strong>
            </blockquote>            
        </fieldset>

        
    </div>
</body>
</html>

Dec 19, 2011 at 3:28 PM

I'm using IIS6.  For IIS6, to make the NG extensionless URLs work, we had to add a Wildcard Application Mapping to the virtual dir/app NG runs in of the .NET4 ISAPI.

Unlike the specific extension-to-ISAPI mappings that let you specify which http verbs are allowable, the wildcard mappings do not.  So I am not sure at what level IIS is rejecting the PUT.

There may be a simple solution, but my IIS6-Fu is not yielding a solution, nor is some time spent Googling it.

Developer
Dec 19, 2011 at 4:29 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.