IIS 7 and Above
Configuration & Scripting
How to enable PUT and DELETE verbs on IIS 7
Last post 9 hours, 45 minutes ago by Dan Konigsbach
Mar 19, 2010 06:43 AM|nikhilthaker|LINK
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.
Nikhil Thaker (MCTS - ASP.NET 3.5)
Verbs in IIS
Mar 19, 2010 07:26 AM|eokim|LINK
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.
Mar 19, 2010 11:56 AM|nikhilthaker|LINK
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.
Mar 19, 2010 11:20 PM|eokim|LINK
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.
Jun 29, 2010 10:35 AM|straatvark|LINK
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.
Jun 29, 2010 01:51 PM|straatvark|LINK
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... ?
Mar 03, 2011 10:07 AM|girish128|LINK
May 04, 2011 10:05 PM|iguanaware|LINK
Remove WebDav from "Modules" and from "Handler Mappings"
WebDAVModule, %windir%\System32\inetsrv\webdav.dll, Native, Inherited
WebDAV, *, Enabled, Unspecified, WebDAVModule, Inherited
Then Restart IIS
It results in a Web.Config change of:
<remove name="WebDAVModule" />
<remove name="WebDAV" />
Jun 24, 2011 01:50 AM|David Glaubman|LINK
Thanks, this fixed my problem and clarified what was going on.
Sep 08, 2012 03:37 AM|kgolding|LINK
Verbs in IIS
9 hours, 45 minutes ago|Dan Konigsbach|LINK
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:
This prevents WebDAV from rejecting verbs that it doesn't support, thus allowing a PUT to flow through to your RESTful handler unmolested.
Verbs in IIS