locked
How to enable PUT and DELETE verbs on IIS 7 RRS feed

  • Question

  • User1362129966 posted

    Hi,

    I am completely a newbie in working with IIS and so I don't know even that I am writing this post in the correct section of the forum or not.

    I have just seen the video by Henrik  Frystyk Nielsen from PDC 09 on developing Rest Applications with .Net framework.

    So I have just created a new  project with downloading "WCF REST Service Application" template.

    Using this template, there are already couple of auto generated methods which are using PUT and DELETE verbs which are not working for me.

    I am using Fiddler to create request over IIS 7.

    Through fiddler GET and POST verbs are working fine but when i use the PUT or DELETE one it shows the error 405 "Method not Allowed".

    I am working on Windows 7 Ultimate 64 bit and it uses IIS 7 (which is by default I suppose, I have just enable the IIS from "Add or Remove Programs").

    I have tried to enable them from "Request Filtering", but that is not working.

    So anyone please let me know how to enable PUT and DELETE verbs in IIS 7.

     

    Thanks,

    Nikhil Thaker (MCTS - ASP.NET 3.5)

     

    Friday, March 19, 2010 1:43 AM

Answers

  • User-1480425032 posted

    Yes, 1) indicates WebDAV module throws 405. You should uninstall it in order to use RESTFull.

    Unfortunetly, they share common http verb and similar protocol.

    The reason why WebDAV throws 405 is that it claims to process the request, but site is not configured to process it.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, March 19, 2010 6:20 PM

All replies

  • User-1480425032 posted

    Here is a few troubleshoot.

    1. Make sure REST service application's handler is in <handlers/> section and it is supposed to set to accept PUT and DELETE verbs.

    2. Enable Failed Request Tracing and check who throws 405.

    3. In case WebDAV is installed, you should 1) uninstall it from the box to use RESTfull service, or 2) remove WebDAVModule from <modules/> in site.

    Let me know whether it helps.

    Friday, March 19, 2010 2:26 AM
  • User1362129966 posted

    Here are the images of Http error in Fiddler with DELETE verb and my web.config file.

    1.> Http error in fiddler

    2.> My application's web.config

    It would be good if you can help with these images.

    Thanks.

     

     

     

    Friday, March 19, 2010 6:56 AM
  • User-1480425032 posted

    Yes, 1) indicates WebDAV module throws 405. You should uninstall it in order to use RESTFull.

    Unfortunetly, they share common http verb and similar protocol.

    The reason why WebDAV throws 405 is that it claims to process the request, but site is not configured to process it.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, March 19, 2010 6:20 PM
  • User-274009987 posted

    Hi,

    I have a similar problem, but Webdav is not installed.

    My error is "401 - Unauthorized: Access is denied due to invalid credentials. + You do not have permission to view this directory or page using the credentials that you supplied"

    This happen ONLY on DELETE & PUT verbs, GET etc is working fine.

     I use IIS7 on Windows 2008 server, my application is in the Asp.Net V4.0 (integrated) pool.

    On the default web site level and application level, all the default handlers for *svc listed allow "all verbs".

    I'm unsure which handler is the correct one (I assume "svc-Integrated-4.0" that use type "System.ServiceModel.Activation.ServiceHttpHandlerFactory"?), so tested all listed anyway.

    If I set a handler not to use all verbs and enter them manually, I can see the "<handlers>" section appear in the applications web.config and settings look ok.

    I tested the requestFiltering settings as well and were able to allow/disallow GET verbs, but it has no effect on my DELETE verb exception.

     Any advice would be much appreciated.

    Tuesday, June 29, 2010 5:35 AM
  • User-274009987 posted

     My issue is sorted.

     I had to enable form authentication in IIS application level to get PUT/DELETE working. (GET worked before without that)

    Strange, but there is no web.config FORM authentication specified. I was under the understanding that Windows is the default mode used when not specified... ?

    Tuesday, June 29, 2010 8:51 AM
  • User1864399624 posted
    I have similar error of 405. But unfortunately I don't know how to enable detail error page in IIS 7.5. I only get the message like this: Server Error 405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access. I am using webClient class to upload a zip file on remote server, and getting the above error. WebDAV is already there, If I enable it, I get 401 - Unauthorized access error and if I am disable it I am getting the 405 error. What should I do to get rid of this situation? I have wasted hours on this error. Same code is running fine on IIS 6.0 if I enable WebDAV under "Web Service Extensions" node of IIS 6.0. Please help. Girish
    Thursday, March 3, 2011 5:07 AM
  • User161227716 posted

     

    Remove WebDav from "Modules" and from "Handler Mappings"

     

    Modules:

                    WebDAVModule, %windir%\System32\inetsrv\webdav.dll, Native, Inherited

     

    Handler Mappings:

                    WebDAV, *, Enabled, Unspecified, WebDAVModule, Inherited

     

    Then Restart IIS

     

     

    It results in a Web.Config change of:

      <system.webServer>

            <modules>

                <remove name="WebDAVModule" />

            </modules>

            <handlers>

                <remove name="WebDAV" />

            </handlers>

      </system.webServer>

     

    -Brian Freeman

    Wednesday, May 4, 2011 5:05 PM
  • User-903417612 posted

    Thanks, this fixed my problem and clarified what was going on.

     David

    Thursday, June 23, 2011 8:50 PM
  • User1813517338 posted
    I was also hitting a consistent 401 error when ever I was trying the use the PUT or DELETE verbs in IIS7 with an ODATA service. In my case this was on an anonymous site and I finally discovered that these verbs will be blocked by default in IIS7 when no authentication mode is provided. By default, the IIS7 authentication mode is Windows, and as I had no user, it was throwing the 401 error for these verbs. (At least I think that was the general issue) Setting the ASP.NET authentication mode to None resolved my issue. SEE: http://msdn.microsoft.com/en-us/library/aa291347(v=VS.71).aspx
    Friday, September 7, 2012 10:37 PM
  • User-2019202832 posted

    For whatever reason, marking WebDAVModule as "remove" in my web.config wasn't enough to fix the problem in my case. 

    I've found another approach that did solve the problem.  Just in case anyone else finds themself in the same boat, I'll pass along what worked for me:

    1. In the IIS Manager, select the application that needs to support PUT.  
    2. In the Features View, find WebDAV Authoring Rules.  Double-click it, or select Open Feature from the context menu (right-click).
    3. In the Actions pane, find and click on WebDAV Settings....
    4. In the WebDAV Settings, find Request Filtering Behavior, and under that, find Allow Verb Filtering.  Set Allow Verb Filtering to False.
    5. In the Actions pane, click Apply.

    This prevents WebDAV from rejecting verbs that it doesn't support, thus allowing a PUT to flow through to your RESTful handler unmolested.

    Wednesday, December 11, 2013 1:27 PM